openloops.word_close#
Close one issue on the owner’s own word, relayed by an assistant (voice, a chat).
The owner says “close issue 207 in my private issues, not planned” to an assistant that
cannot be at his terminal. A close is reversible (reopen), but a wrong one is easy to miss:
an obligation drops out of ol owed and nobody notices. So every guard here is in code,
not in the assistant’s promise, and every close is visible afterwards.
For one issue per call, close_on_word() refuses unless all of these hold:
the repository is PRIVATE, has no outside collaborators (unreadable counts as shared), and its owner is a trusted one (
closer.owners,openloops.closer.close_settings());the number is an open issue, not a pull request, filed under the person’s own login;
expect_title(a few words of the title the assistant read back) is in the title, compared without case, punctuation or extra spaces: a misheard number fails here;fewer than
capcloses were made this way today (UTC), counted in a local ledger;a
manual-taskwhose**Verify:**check does not pass is not closed ascompleted(not plannedstill is): a report alone never closes an owed task as done, as inopenloops.closer.
The close carries the owner’s comment (scrubbed of home paths and credentials, capped),
a fixed last line saying how it was closed, and the label WORD_LABEL, so
word_closes() (ol voice-log) lists every one for a brief, with how to reopen it.
Seams: gh= ((args, *, input=None) -> (status, stdout), the gh CLI by
default), settings= (CloseSettings), ledger= (a JSONL
file under ~/.local/share/openloops/), run_check=, now=.
Functions
|
Close issue number of repo if every guard in the module docstring holds. |
|
|
Where closes made this way are counted: |
|
|
Whether the words read back are in the title (case, punctuation, spacing ignored). |
|
Issues closed on the owner's word in the last days, newest first, from GitHub (the label is the record, so any machine can list them). |
- openloops.word_close.close_on_word(repo, number, *, reason, comment, expect_title, by='bosun', cap=5, gh=<function _gh_cli>, settings=None, ledger=None, run_check=<function default_run_check>, now=None, dry_run=False)[source]#
Close issue number of repo if every guard in the module docstring holds.
Returns
{ref, action, reason, title, say}:actionisclosed,would-close(dry_run) orrefused;sayis one line to read back to the owner.
- openloops.word_close.default_ledger()[source]#
Where closes made this way are counted:
~/.local/share/openloops/word-closes.jsonl.- Return type:
- openloops.word_close.split_ref(ref)[source]#
(repo, number)fromOWNER/REPO#NUMBERonly: a URL is refused, sincegh issue close <url>would ignore the repository it was checked against.>>> split_ref('me/_private#207') ('me/_private', 207) >>> split_ref('https://github.com/me/x/issues/1') Traceback (most recent call last): ... ValueError: not OWNER/REPO#NUMBER: 'https://github.com/me/x/issues/1'
- openloops.word_close.title_matches(expect, title)[source]#
Whether the words read back are in the title (case, punctuation, spacing ignored).
>>> title_matches('Bosun: close #207', '[tp] Bosun -- close #207 now') True >>> title_matches('wrong issue', 'Bosun close 207') False
- Return type:
- openloops.word_close.word_closes(*, owners=(), days=1, gh=<function _gh_cli>, now=None)[source]#
Issues closed on the owner’s word in the last days, newest first, from GitHub (the label is the record, so any machine can list them).
Each row:
{ref, title, closedAt, url, undo}(undo: the command that reopens it).