plushu / plushu-plushook-plugin

A plugin for invoking `plushook` directly, for debugging/recovery purposes.
MIT License
0 stars 0 forks source link

What a `plushook` plugin needs #1

Open stuartpb opened 9 years ago

stuartpb commented 9 years ago

An up-front explanation of why it exists

Specific important points to convey:

This should probably be a separate opts plugin(s). You can do -e, --env, and something=value as three different types of plugin. This isn't a responsibility for this plugin, but it is a feature one may need alongside this, as some plushooks employ environment variables for certain mechanics (like the ones that use semaphores to avoid infinite loops, like those of the app/repo two-way binding plugin).

Also good to keep this in separate plugins since letting users specify arbitrary environment variables is even more of a security hole than letting them do arbitrary plushooks (not just in terms of Shellshock - it's why SSH doesn't forward / accept environment variables without lots of explicit configuration).

Other "porcelain plumbing" plugins

Sometimes plugins have features that haven't had any porcelain-based way of accessing them, sort of like how Atari Flashback systems have a pin-out for a cartridge slot on the mainboard but no actual console slot on the device. (RC scripts, like plushurc and (probably more so) the receive and build RCs in apps, are a good example of this right now: without any porcelain commands to edit them, the files have to get there, essentially, by magic.)

Usually / ideally, the place for this is to actually create a new porcelain plugin to do what you want with these dangling features (see the last bullet of the first section). For instance, if you wanted a way to add/remove PLUSHU_TRACE=1 from .plushurc, you could make a plugin for that (and, indeed, that's an issue on the feature wishlist for the plushu-trace plugin right now).

Also, the more open-ended aspects of these dangling are traditionally made for The Admin, which is a thoroughly different role (if not a different person) from The User. There's no mainstream way of accessing them for The User because The User shouldn't be messing with features that are that essential.

However, when THERE'S JUST NO TIME to get it right, you want to hack it RIGHT NOW NOW, and you can't (or don't want to) get out of your comfort zone as The User, you can use a plugin like this.

Other potential plugins of this level of debugging/hacking:

Really though, at that point you might as well just use some Plushu plugin that exposes performing arbitrary commands / interactive sessions, at which point you're kind of subverting a lot of the whole point of Plushu (a streamlined porcelain experience via commands) in the first place. Again - that is what The Admin role is supposed to be for. (Add sudoers rules to let users sudo as the plushu user if you want non-root users to be able to do Plushu admin stuff with non-Plushu shells.)

The pithy slogan to sum it up: porcelain plumbing is an antipattern. Surfacing a high-level UX allowing you to perform low-level implementation tasks is a sign that your abstraction is leaking too heavily.

(And yes, this incidentally asserts the conclusion that Git has a ton of leaky abstractions. It does.)

Always specifying -i

Since this plugin's use should be sparing, the overhead for this in all cases where this plugin is needed is acceptable, especially considering that it obviates the need to add a long-/short-opts source (which would also needlessly pollute plushu's opts space). (If a plushook hinges on not inheriting stdin, you'll have to pipe in /dev/null manually to get the same effect as not specifying -i.)

stuartpb commented 9 years ago

There will probably be a porcelain-plumbing metaplugin for all this, as one of those hipster ha-ha-only-serious things