Skip to content

setup-util: support pkgx#293

Open
joelmccracken wants to merge 3 commits intobevry:masterfrom
joelmccracken:jnm/customize-install-order-use-pkgx
Open

setup-util: support pkgx#293
joelmccracken wants to merge 3 commits intobevry:masterfrom
joelmccracken:jnm/customize-install-order-use-pkgx

Conversation

@joelmccracken
Copy link
Copy Markdown
Contributor

done with this for the night, just submitting now for some review. I'd like to actually write a test or two so I can be confident I actually did the logic right.

@joelmccracken joelmccracken force-pushed the jnm/customize-install-order-use-pkgx branch from cecd4d2 to 9f1febe Compare April 5, 2025 20:31
balupton added a commit that referenced this pull request Oct 3, 2025
Changes:
- Removed outdated/stale/deprecated autocompleters of the old github copilot and tea.
- Also, update the URL and GitHub for carapace which has now been updated.

The new GitHub CLI is now available via <https://github.com/github/copilot-cli>

Which is an app rather than an autocompleter. Remove the old ones:
- `npm uninstall -g github-copilot-cli` for <https://www.npmjs.com/package/@githubnext/github-copilot-cli>
- `gh extension remove github/gh-copilot` for <https://github.com/github/gh-copilot>

Tea is vapourware (no github activity, all tea.xyz URLs 404).
Its innovation now live on as PKGX, which isn't about autocomplete.
As such, remove tea autocomplete.
The `setup-util` code for tea persists, as it can be worked later for PKGX, /ref #293
@balupton balupton changed the title Jnm/customize install order use pkgx setup-util: support pkgx Oct 3, 2025
balupton added a commit that referenced this pull request Oct 25, 2025
Changes:
- Removed outdated/stale/deprecated autocompleters of the old github copilot and tea.
- Also, update the URL and GitHub for carapace which has now been updated.

The new GitHub CLI is now available via <https://github.com/github/copilot-cli>

Which is an app rather than an autocompleter. Remove the old ones:
- `npm uninstall -g github-copilot-cli` for <https://www.npmjs.com/package/@githubnext/github-copilot-cli>
- `gh extension remove github/gh-copilot` for <https://github.com/github/gh-copilot>

Tea is vapourware (no github activity, all tea.xyz URLs 404).
Its innovation now live on as PKGX, which isn't about autocomplete.
As such, remove tea autocomplete.
The `setup-util` code for tea persists, as it can be worked later for PKGX, /ref #293
balupton added a commit that referenced this pull request Oct 25, 2025
Changes:
- Removed outdated/stale/deprecated autocompleters of the old github copilot and tea.
- Also, update the URL and GitHub for carapace which has now been updated.

The new GitHub CLI is now available via <https://github.com/github/copilot-cli>

Which is an app rather than an autocompleter. Remove the old ones:
- `npm uninstall -g github-copilot-cli` for <https://www.npmjs.com/package/@githubnext/github-copilot-cli>
- `gh extension remove github/gh-copilot` for <https://github.com/github/gh-copilot>

Tea is vapourware (no github activity, all tea.xyz URLs 404).
Its innovation now live on as PKGX, which isn't about autocomplete.
As such, remove tea autocomplete.
The `setup-util` code for tea persists, as it can be worked later for PKGX, /ref #293
balupton added a commit that referenced this pull request Oct 25, 2025
Changes:
- Removed outdated/stale/deprecated autocompleters of the old github copilot and tea.
- Also, update the URL and GitHub for carapace which has now been updated.

The new GitHub CLI is now available via <https://github.com/github/copilot-cli>

Which is an app rather than an autocompleter. Remove the old ones:
- `npm uninstall -g github-copilot-cli` for <https://www.npmjs.com/package/@githubnext/github-copilot-cli>
- `gh extension remove github/gh-copilot` for <https://github.com/github/gh-copilot>

Tea is vapourware (no github activity, all tea.xyz URLs 404).
Its innovation now live on as PKGX, which isn't about autocomplete.
As such, remove tea autocomplete.
The `setup-util` code for tea persists, as it can be worked later for PKGX, /ref #293
@balupton
Copy link
Copy Markdown
Member

balupton commented Nov 3, 2025

I'm removing tea from setup-util, here was its code:

	# note that tea doesn't provide man pages, even via [tea man bat]
	function remove_tea_cache {
		local package="$1" subpath path
		# this entire cache of the package must be removed, not just [tea -n "$option_cli"]
		# see https://discord.com/channels/906608167901876256/906608288026734622/1134327807544135770
		subpath="${package:1}" # get everything after the +
		path="$HOME/.tea/$subpath"
		if [[ -d $path ]]; then
			rm_helper "$path"
			return 0
		fi
		return 200 # ECUSTOM 200 Not applicable to this package system
	}
	function remove_tea_xdg_bin_alias {
		if is-symlink -- "$XDG_BIN_HOME/$option_cli"; then
			if [[ "$(fs-path --resolve -- "$XDG_BIN_HOME/$option_cli")" == "$(type -P tea)" ]]; then
				rm_helper "$XDG_BIN_HOME/$option_cli"
				return 0 # is applicable
			fi
		fi
		return 200 # ECUSTOM 200 Not applicable to this package system
	}
	function remove_tea_package {
		local package="$1" ec1 ec2
		__do --redirect-status={ec1} -- remove_tea_xdg_bin_alias
		__do --redirect-status={ec2} -- remove_tea_cache "$package"
		if [[ $ec1 -ne 0 && $ec1 -ne 200 ]]; then
			return "$ec1" # error
		elif [[ $ec2 -ne 0 && $ec2 -ne 200 ]]; then
			return "$ec2" # error
		elif [[ $ec1 -eq 0 || $ec2 -eq 0 ]]; then
			return 0 # was applicable
		else
			return 200 # ECUSTOM 200 Not applicable to this package system
		fi
	}
	function __check_tea {
		local packages=("${TEA[@]}")

		# check if applicable
		if [[ ${#packages[@]} -eq 0 ]]; then
			return 200 # ECUSTOM 200 Not applicable to this utility
		fi
		if __command_missing -- tea; then
			fallbacks+=('tea')
			return 200 # ECUSTOM 200 Not applicable yet but provided fallback
		fi
		if [[ -z $option_cli ]]; then
			__print_style --stderr --error='TEA requires <cli>'
			return 22 # EINVAL 22 Invalid argument
		fi
		if [[ -z $option_cli ]]; then
			__print_style --stderr --error='TEA requires <cli>'
			return 22 # EINVAL 22 Invalid argument
		fi
	}
	function do_tea {
		local packages=("${TEA[@]}") repo tea_status result=200

		# handle each package
		for package in "${packages[@]}"; do
			# check
			if [[ $package != '+'* ]]; then
				__print_style --stderr --error1='TEA packages must begin with a plus sign ' --code-error1='+' --error1=' e.g. ' --code-error1="--cli='jq' TEA='+stedolan.github.io/jq'"
				return 22 # EINVAL 22 Invalid argument
			fi

			# uninstall
			if [[ $option_action == 'uninstall' ]]; then
				__try {tea_status} -- remove_tea_package "$package"
				if [[ $tea_status -eq 0 ]]; then
					result=0
				fi
			else
				# install / upgrade
				result=0

				# install it by doing [tea $package --version]
				# it would be nice to use [command-working] however [command-working] currently expects multiple commands as arguments so it would become [command-working -- tea, command-working $package, command-working --version]
				tea "$package" "$option_cli" --version

				# make tea alias available
				__mkdirp "$XDG_BIN_HOME"
				fs-link --quiet="$option_quiet" \
					--existing="$(type -P tea)" --symlink="$XDG_BIN_HOME/$option_cli"
			fi
		done
		return "$result"
	}
	function do_tea_fallback {
		log_fallback 'Tea'
		setup-util-tea --quiet="$option_quiet"
		source "$DOROTHY/sources/environment.sh"
		do_tea "$@"
	}

@balupton
Copy link
Copy Markdown
Member

balupton commented Nov 7, 2025

Flox seems to be another likewise tool: https://flox.dev/

I guess the market for such tooling has opened up and we are going to see a lot of grifts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants