Files
omarchycn/bin/omarchy-plugin-catalog
T
David Heinemeier Hansson 055ffaccd4 Split omarchy-plugin into siblings and consolidate bar config into omarchy-bar
omarchy-plugin mixed plugin lifecycle, clone/edit, and bar-layout mutation.
The bar layout was mutated by two separate engines (an embedded Python
mutate_bar here and jq in omarchy-config-shell-bar), each with its own
manifest walker.

- omarchy-plugin is now a ~220-line router; clone and edit move to
  omarchy-plugin-clone and omarchy-plugin-edit, matching the existing
  plugin-{source,add,update,remove,available,validate,scan} sibling pattern
- omarchy-config-shell-bar is replaced by omarchy-bar, the single bar engine
  (show/layout/list/options/use/reset/add/move/remove/set/replace/position/
  transparent/settings) with one jq pipeline; the Python mutate_bar and its
  python3 dependency are gone
- omarchy-plugin-catalog is the shared manifest scanner used by omarchy-bar
  (widget/option enumeration, add validation) and omarchy-plugin-clone
  (source enumeration), replacing three find|jq re-implementations
- service install/remove and refresh-shell call omarchy-bar; docs and tests
  updated to the new command surface
2026-07-02 11:10:24 -07:00

68 lines
2.3 KiB
Bash
Executable File

#!/bin/bash
# omarchy:summary=Emit every first-party and user plugin manifest as JSON
# omarchy:group=plugin
# omarchy:hidden=true
# Walks $OMARCHY_PATH/shell/plugins and ~/.config/omarchy/plugins, reads every
# manifest.json / *.manifest.json, and emits one JSON object per plugin with
# computed fields (sourceDir, barWidgetPath, barPath, firstParty). This is the
# single source of truth that omarchy-bar (widget/option enumeration and add
# validation) and omarchy-plugin-clone (source enumeration) read, so the bar
# and plugin commands never re-implement manifest walking.
set -o pipefail
OMARCHY_PATH="${OMARCHY_PATH:-}"
command -v jq >/dev/null 2>&1 || { echo "omarchy-plugin-catalog: jq is required" >&2; exit 1; }
paths=()
if [[ -n $OMARCHY_PATH && -d $OMARCHY_PATH/shell/plugins ]]; then
while IFS= read -r manifest; do
paths+=("$manifest")
done < <(find "$OMARCHY_PATH/shell/plugins" -mindepth 2 -maxdepth 4 -type f \( -name manifest.json -o -name '*.manifest.json' \) 2>/dev/null | sort)
fi
user_dir="$HOME/.config/omarchy/plugins"
if [[ -d $user_dir ]]; then
while IFS= read -r manifest; do
paths+=("$manifest")
done < <(find -L "$user_dir" -mindepth 2 -maxdepth 2 -type f -name manifest.json 2>/dev/null | sort)
fi
if (( ${#paths[@]} == 0 )); then
echo "[]"
exit 0
fi
jq -n '
[ inputs
| . as $manifest
| input_filename as $manifestPath
| ($manifestPath | sub("/manifest.json$"; "") | sub("/[^/]+\\.manifest\\.json$"; "")) as $sourceDir
| {
id: ($manifest.id // ""),
name: ($manifest.name // $manifest.id // ""),
description: ($manifest.description // ""),
kinds: ($manifest.kinds // []),
firstParty: (($manifest.id // "") | startswith("omarchy.")),
manifestPath: $manifestPath,
sourceDir: $sourceDir,
entryPoints: ($manifest.entryPoints // {}),
barWidget: ($manifest.barWidget // null),
bar: ($manifest.bar // null)
}
| .barWidgetPath = (
if (.entryPoints.barWidget // null) != null
then (.sourceDir + "/" + .entryPoints.barWidget)
else null end)
| .barPath = (
if (.entryPoints.bar // null) != null
then (.sourceDir + "/" + .entryPoints.bar)
else null end)
| select(.id != "")
]
| unique_by(.id)
' "${paths[@]}"