feat(completion): new package - urfave/cli v3 shell completion installer #96

Closed
opened 2026-06-07 04:07:41 +00:00 by coilysiren · 1 comment
Owner

Extraction candidate from the coily cmd/coily/ generic-code audit (2026-06-06). Source pinned at coily commit c7c17cb (canonical: forgejo.coilysiren.me/coilyco-bridge/coily). cli-guard is mid-refactor, so the "suggested home" below is the pre-refactor package layout - land this in whatever the post-refactor equivalent is, not necessarily the named package. The durable principle: the classifiers / argv-transforms are generic and move; the policy decisions and message copy stay in coily.

Source: cmd/coily/ops_install_completion.go - the install-completion verb, detectShell(), and the bash/zsh/fish script templates.

What it does: detects the shell from $SHELL, writes a sourceable completion script wiring the binary into urfave/cli's --generate-shell-completion protocol, with --dry-run and printed activation instructions.

Generic core (lift this): the three completion script templates are standard urfave/cli v3 boilerplate; detectShell() is fully generic.

Consumer seam to parameterize: the literal coily token threaded through every script body, the install paths (~/.local/share/coily/..., ~/.config/fish/completions/coily.fish), and the instruction strings -> one binName string argument with all paths/templates derived from it.

Suggested home (pre-refactor): new completion package, or fold into shell.

Done when:

  • generic logic lives in cli-guard with zero coily/Kai/Forgejo identifiers or defaults
  • behavior-covered tests (table tests where the source has them)
  • godoc-current.txt regenerated (scripts/check-godoc-current.sh --update)
  • coily migrated onto the extracted API, its local copy deleted, make test green both sides
  • closes this issue

Why it matters: pure boilerplate every guarded CLI re-implements; single-parameter extraction.

> Extraction candidate from the coily `cmd/coily/` generic-code audit (2026-06-06). Source pinned at coily commit `c7c17cb` (canonical: `forgejo.coilysiren.me/coilyco-bridge/coily`). **cli-guard is mid-refactor**, so the "suggested home" below is the pre-refactor package layout - land this in whatever the post-refactor equivalent is, not necessarily the named package. The durable principle: **the classifiers / argv-transforms are generic and move; the policy decisions and message copy stay in coily.** **Source:** `cmd/coily/ops_install_completion.go` - the `install-completion` verb, `detectShell()`, and the bash/zsh/fish script templates. **What it does:** detects the shell from `$SHELL`, writes a sourceable completion script wiring the binary into urfave/cli's `--generate-shell-completion` protocol, with `--dry-run` and printed activation instructions. **Generic core (lift this):** the three completion script templates are standard urfave/cli v3 boilerplate; `detectShell()` is fully generic. **Consumer seam to parameterize:** the literal `coily` token threaded through every script body, the install paths (`~/.local/share/coily/...`, `~/.config/fish/completions/coily.fish`), and the instruction strings -> one `binName string` argument with all paths/templates derived from it. **Suggested home (pre-refactor):** new `completion` package, or fold into `shell`. **Done when:** - [ ] generic logic lives in cli-guard with zero coily/Kai/Forgejo identifiers or defaults - [ ] behavior-covered tests (table tests where the source has them) - [ ] `godoc-current.txt` regenerated (`scripts/check-godoc-current.sh --update`) - [ ] coily migrated onto the extracted API, its local copy deleted, `make test` green both sides - [ ] `closes` this issue **Why it matters:** pure boilerplate every guarded CLI re-implements; single-parameter extraction.
Author
Owner

Backlog burndown 2026-06-17: closing low-priority (P3/P4) to bring the open count to a manageable level. Nothing lost — reopen if this resurfaces. Batch tag: burndown-2026-06.

Backlog burndown 2026-06-17: closing low-priority (P3/P4) to bring the open count to a manageable level. Nothing lost — reopen if this resurfaces. Batch tag: `burndown-2026-06`.
coilysiren 2026-06-17 08:23:22 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
coilyco-flight-deck/cli-guard#96
No description provided.