gh-custom-properties

command module
v0.0.0-...-ed53d3c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

gh-custom-properties

CI

A terminal UI for viewing, adding, editing, and deleting GitHub custom properties on a repository — either one repo at a time, or in bulk across a list of repos loaded from a file. Every change is preceded by a timestamped backup of the prior values.

Demo

GH-Custom-Properties Demo

Install

go install github.com/ByronJones-Elsevier/gh-custom-properties@latest

Or build from a checkout:

go build -o gh-custom-properties .

Authentication

A GitHub token is required, resolved in this order:

  1. --token
  2. GITHUB_TOKEN environment variable
  3. gh auth token (if the gh CLI is installed and logged in)

The token needs permission to read and write custom properties on the target repos (repo scope, or the equivalent fine-grained "Custom properties" permission), and organization membership/read access to fetch the org's custom-property schema. If the schema can't be read, the tool still works — it just falls back to freeform text entry for property values instead of type-aware pickers.

Usage

Every screen has a top bar (commands on the left, the repo/org context right-aligned) and, on the property list and repo table, a boxed command reference pinned to the bottom — it shows one line when everything fits, wrapping onto more lines rather than eliding any command if the terminal's too narrow for one line.

Single repo, interactively:

gh-custom-properties

Single repo, given up front:

gh-custom-properties octocat/hello-world
gh-custom-properties https://github.com/octocat/hello-world

Non-interactive (no TUI), for scripting:

gh-custom-properties --list octocat/hello-world
gh-custom-properties --set team=platform --set tags=a,b octocat/hello-world
gh-custom-properties --set team=platform --list octocat/hello-world

--list prints one name=value line per property (multi-select values are comma-joined). --set name=value is repeatable; an empty value (team=) clears the property. When the org schema is readable, values are validated first (unknown names, disallowed select options, non-boolean true_false values, clearing a required property) and nothing is written on error. A backup is written before any change, as in the TUI. --list output goes to stdout; --set progress and the backup path go to stderr. Both require a repo argument and can't be combined with --file.

Within the single-repo screen:

Key Action
↑/↓ or j/k move selection
pgup/pgdn, f7/f8, shift+↑/shift+↓ page through a long list
a add a property (from the org schema, or freeform if unavailable)
enter/e edit the selected property's value
d delete the selected property (confirm with y)
s apply all changes (writes a backup first, then patches GitHub)
o open the repo's Custom properties settings page in your web browser
? filter the list by name (typing narrows it live; esc clears)
q quit (confirm with y/enter; any other key cancels)

See Global keybindings below for F1/F5/Ctrl-C, which work on every screen.

Batch mode, across a list of repos:

gh-custom-properties --file repos.txt

repos.txt lists one repo per line, as owner/repo or a github.com URL. Blank lines and lines starting with # are ignored:

# platform team repos
octocat/hello-world
octocat/other-repo
https://github.com/octocat/a-third-repo

The batch screen loads and summarizes every repo's current properties, then b opens the bulk-edit flow: choose to set or delete a property, pick its value (again type-aware when the org schema is available), choose which loaded repos to target (defaults to all), and apply. You can run several bulk edits in one session before quitting; each apply writes its own backup.

Batch mode assumes the repo list is drawn from a single GitHub org — the bulk-edit property picker is built from the first successfully loaded repo's org schema. If a repo in a different org doesn't recognize the chosen property, that repo's apply result will show the API error rather than being silently skipped.

On the repo table: ↑/↓/j/k and paging move the selection, enter/e opens the selected repo's individual property screen, and ? filters the table by owner/repo. The individual screen shows every field defined by the organization schema, including fields that are currently unset, and supports the same add/edit/delete/apply workflow as single-repo mode. Press esc or q to return to the repo table without saving. b starts a bulk edit, o opens the selected repo's Custom properties settings page in your web browser, x exports every loaded repo and its values—including a repo_url column—to a timestamped CSV in the current directory, F5 re-fetches every repo from GitHub (discarding nothing — batch mode never stages unapplied edits), and q quits from the table. Press u to unload the selected repo from the active list; after confirmation it is excluded from future bulk edits and refreshes for the current session.

The metadata columns are owner, repo, and repo_url. If a custom property has the same name as one of those columns, its CSV header is prefixed with property_ to keep every column unambiguous.

Global keybindings

These work on every screen, in both modes:

Key Action
F1 show/close a keybinding reference
F5 refresh from GitHub (property list / repo table only)
ctrl+c / q* quit — asks to confirm; a second press (or y/enter) confirms, any other key cancels
tab in the add/edit editor, same as enter (confirm/advance)
shift+tab in the add editor's value step, go back and pick a different property

* q only means quit on the property list / repo table screens — elsewhere (e.g. typing a repo name or a property value) it's just the letter q. ctrl+q is deliberately unbound: terminals use it for XON/XOFF flow control.

Every custom command above (a/e/d/s/o/q/b) also matches alt+<letter>, honoring the equivalent of the common "Alt-key shortcut" terminal convention. This only does something on terminals that support the Kitty keyboard protocol (kitty, WezTerm, Ghostty, newer iTerm2 builds) or that have "Use Option as Meta Key" enabled — notably not macOS's default Terminal.app — so the bare letter is always there as the reliable fallback.

Backups

Before any change is applied — single-repo or batch — a timestamped JSON snapshot of the properties' prior values is written to $HOME/.gh-custom-properties/backups/ (override with --backup-dir, the GH_CUSTOM_PROPERTIES_BACKUP_DIR environment variable, or backup_dir= in the config file). If the pre-change fetch fails, no backup is written and the change is not applied.

  • Single-repo apply: owner-repo-20260901-153000.json
  • Batch apply (one file per bulk-edit run, however many repos it touches): batch-20260901-153000.json
{
  "timestamp": "2026-09-01T15:30:00Z",
  "mode": "single",
  "repos": [
    {"owner": "octocat", "repo": "hello-world",
     "properties_before": [{"name": "team", "value": "platform"}]}
  ]
}

Elsevier standard properties

Dropdown-style properties (MigrationReady, ReviewComplete, SystemType, TargetOrg, TechOrg, TechOrgGroup, ...) always get their allowed values live from the org's schema (GET /orgs/{org}/properties/schema) — nothing is hardcoded, so the dropdown list can't go stale.

GitHub's schema only knows a property is string, though, not that it should look like an email address or a date. For Elsevier's standard string-typed properties, gh-custom-properties adds that format validation client-side (internal/knownprops), rejecting the value (with an inline error) until it's fixed:

Property Required format
CostCode alphanumeric, or blank (unsets the property)
SystemID alphanumeric, or blank (unsets the property)
SystemName alphanumeric, or blank (unsets the property)
owner email address
MigrationReadyDate YYYY-MM-DD

Configuration

Settings load from $HOME/.gh-custom-properties/config (a plain key=value file), then environment variables, then command-line flags, each overriding the last:

backup_dir=/some/path
token=ghp_...

The color theme is config-file-only (no env/flag override), and falls back to the built-in defaults for anything unset:

color_title=212      # screen titles
color_header=39      # the persistent owner/repo (or org — N repo(s)) banner
color_cursor=212      # the selected row's cursor
color_selected=212    # the selected row's text
color_dim=240         # secondary text (scroll indicators, "(unset)", filter box)
color_error=203       # error messages
color_success=42      # success messages
color_warn=214        # warnings (e.g. org schema unavailable)
color_help=240        # footer key hints

Values are lipgloss color specs: an ANSI 256 color number ("212") or a hex code ("#ff69b4").

Set the NO_COLOR environment variable to any non-empty value to turn colors off (see https://no-color.org); bold and underline remain, and the top bar is drawn in reverse video.

Development

See ENGINEERING.md for the specification, package layout, and design notes; HANDOFF.md for outstanding work; CHANGELOG.md for history; and AGENTS.md for notes aimed at an AI coding agent picking this repo back up.

make help   # list every target
make all    # fmt/check, vet, lint, test, build — mirrors CI
make vuln   # govulncheck (needs network)
make build  # just build the binary
make test   # just run the test suite
make run ARGS="--file repos.txt"   # build and run with flags

make lint needs golangci-lint installed. CI (.github/workflows/ci.yml) runs the same checks (plus macOS, and a check that docs/*.1/docs/*.html match what go generate produces) on every push and pull request to main.

License

MIT, copyright 2026 Byron Scott Jones.

Documentation

Overview

Command gh-custom-properties is a terminal UI for viewing, adding, editing, and deleting GitHub custom properties on a repo, or across a batch of repos listed in a file.

Directories

Path Synopsis
docs
gendocs command
Command gendocs regenerates docs/gh-custom-properties.1 (man page) and docs/gh-custom-properties.html (HTML help) from the CLI spec in internal/clidoc, so the two never drift from what -h/--help prints.
Command gendocs regenerates docs/gh-custom-properties.1 (man page) and docs/gh-custom-properties.html (HTML help) from the CLI spec in internal/clidoc, so the two never drift from what -h/--help prints.
internal
backup
Package backup writes timestamped JSON snapshots of custom-property values before they are overwritten, so an operator can recover the prior state of a repo (or a whole batch run) after applying a change.
Package backup writes timestamped JSON snapshots of custom-property values before they are overwritten, so an operator can recover the prior state of a repo (or a whole batch run) after applying a change.
browser
Package browser builds github.com URLs for a repository and opens them in the user's default web browser.
Package browser builds github.com URLs for a repository and opens them in the user's default web browser.
clidoc
Package clidoc is the single source of truth for gh-custom-properties' command-line surface: main.go renders it as the -h/--help text, and docs/gendocs renders it as the man page and HTML help file, so the three never drift apart.
Package clidoc is the single source of truth for gh-custom-properties' command-line surface: main.go renders it as the -h/--help text, and docs/gendocs renders it as the man page and HTML help file, so the three never drift apart.
config
Package config loads gh-custom-properties settings from $HOME/.gh-custom-properties/config (a simple key=value file), then lets environment variables and finally command-line flags override those defaults, in that order.
Package config loads gh-custom-properties settings from $HOME/.gh-custom-properties/config (a simple key=value file), then lets environment variables and finally command-line flags override those defaults, in that order.
ghclient
Package ghclient talks to the GitHub REST API for custom repository properties.
Package ghclient talks to the GitHub REST API for custom repository properties.
headless
Package headless implements the non-interactive --list and --set modes of the CLI: print a repo's custom properties, and/or update some of them, without starting the TUI.
Package headless implements the non-interactive --list and --set modes of the CLI: print a repo's custom properties, and/or update some of them, without starting the TUI.
knownprops
Package knownprops adds Elsevier-specific input validation for custom properties whose format GitHub's schema can't express.
Package knownprops adds Elsevier-specific input validation for custom properties whose format GitHub's schema can't express.
repolist
Package repolist parses the --file argument for batch mode: a plain text file listing one GitHub repo per line.
Package repolist parses the --file argument for batch mode: a plain text file listing one GitHub repo per line.
termkeys
Package termkeys optionally enables a terminal's Kitty keyboard protocol disambiguation flag, so Alt+letter keypresses arrive as a distinct key event on terminals that support it (kitty, WezTerm, Ghostty, and newer iTerm2 builds).
Package termkeys optionally enables a terminal's Kitty keyboard protocol disambiguation flag, so Alt+letter keypresses arrive as a distinct key event on terminals that support it (kitty, WezTerm, Ghostty, and newer iTerm2 builds).
tui
Package tui implements the Bubble Tea interface for viewing, adding, editing, and deleting GitHub custom repository properties, either for a single repo or across a batch of repos loaded from a file.
Package tui implements the Bubble Tea interface for viewing, adding, editing, and deleting GitHub custom repository properties, either for a single repo or across a batch of repos loaded from a file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL