- Split the monolith into package/provider/fetch/merge/cache modules with the Resolver deciding install/adopt/update/merge/conflict outcomes - Three-way merges via git merge-file/diff3 against a content-addressed merge-base cache; conflicts go to a .picopackage-merge sibling - Tests for package, provider, resolver, merge, and cache - notes.md: update UX and signing design — diff-by-default, SSH signature identity pinning (TOFU), key changes as a hard stop, exit-code contract - Add CLAUDE.md; remove the pre-refactor exe/pppkg monolith and scratch files Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EiyJC73Mz8xZyCTvCEY8qn
19 lines
555 B
Ruby
19 lines
555 B
Ruby
# Make an array of hashes contain a unique value for key:
|
|
def uniquify_array(array, key)
|
|
array.group_by { |item| item[key] }.map do |_, items|
|
|
(items.length > 1) ? yield(items) : items.first
|
|
end
|
|
end
|
|
|
|
# new_array = uniquify_array(array, :some_key) do |dupes|
|
|
# dupes.max_by { |item| item[:updated_at] }
|
|
# end
|
|
|
|
# @PICOPACKAGE_START
|
|
# ---
|
|
# filename: uniquify_array.rb
|
|
# url: https://api.github.com/gists/525ac4177964549ee2f2ca7febd03eea
|
|
# version: 0.1
|
|
# source_url: https://gist.github.com/dkam/525ac4177964549ee2f2ca7febd03eea
|
|
# @PICOPACKAGE_END
|