cli¶
- afwf_github.cli.require_config(method: Callable) Callable[source]¶
Decorator that resolves and loads config before calling a CLI method.
Resolution order: 1. If
self.config_fileis set, load from that path. 2. Otherwise use the default path (path_enum.path_config_json).On any failure (file missing, parse error) the decorator outputs a single error
Itemthat opens the project README on Enter, then returns early so the wrapped method is never called.On success,
self._configis populated and the wrapped method runs normally.functools.wrapsis still required in Python 3.10+ to copy__name__,__doc__,__wrapped__, etc. onto the wrapper —ParamSpec(added in 3.10) improves type-checker inference for decorators but does not replacefunctools.wraps.
- class afwf_github.cli.Command(config_file: str | None = None)[source]¶
Alfred GitHub Workflow CLI.
All subcommands accept an optional
--config-fileargument (absolute or relative path). When omitted, config is loaded from the default location viadefault_config.- property default_config: Config¶
Load config from the default path (
~/.alfred-afwf/afwf_github/config.json).
- edit_config() None[source]¶
Script Filter: open config.json in the default editor.
Creates a blank template at the default path if the file does not yet exist, then opens it via Alfred’s Open File action.
- Alfred Script field (dev):
.venv/bin/afwf-github edit-config
- Alfred Script field (prod):
~/.local/bin/uvx –from afwf_github==<ver> afwf-github edit-config
- view_in_browser(path: str = '') None[source]¶
Script Filter: given a local file or directory path, open its GitHub URL in the browser.
- Alfred Script field (dev):
.venv/bin/afwf-github view-in-browser –path ‘{query}’
- Alfred Script field (prod):
~/.local/bin/uvx –from afwf_github==<ver> afwf-github view-in-browser –path ‘{query}’
- search_repo(query: str = '') None[source]¶
Script Filter: search GitHub repositories in the local index.
- Alfred Script field (dev):
.venv/bin/afwf-github search-repo –query ‘{query}’
- Alfred Script field (prod):
~/.local/bin/uvx –from afwf_github==<ver> afwf-github search-repo –query ‘{query}’
- rebuild_index() None[source]¶
Script Filter: show a single item that triggers
rebuild-index-actionon Enter.- Alfred Script field (dev):
.venv/bin/afwf-github rebuild-index
- Alfred Script field (prod):
~/.local/bin/uvx –from afwf_github==<ver> afwf-github rebuild-index
- rebuild_index_action() None[source]¶
Rebuild the local repo search index by re-fetching data from GitHub.
Called by Alfred’s Run Script widget — NOT a Script Filter.
- Alfred Run Script field (dev):
.venv/bin/afwf-github rebuild-index-action
- Alfred Run Script field (prod):
~/.local/bin/uvx –from afwf_github==<ver> afwf-github rebuild-index-action