ai-push-hooks 0.1.14 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/package.json +1 -1
- package/pyproject.toml +1 -1
- package/src/ai_push_hooks/executors/llm.py +4 -15
package/README.md
CHANGED
|
@@ -24,9 +24,9 @@ pnpm add -D ai-push-hooks
|
|
|
24
24
|
|
|
25
25
|
Requirements:
|
|
26
26
|
|
|
27
|
-
- Python 3.10+ (`python3` or `python`) is required, including npm installs.
|
|
28
|
-
-
|
|
29
|
-
- `gh` is required only if you use PR creation via `gh_pr_create`.
|
|
27
|
+
- [Python 3.10+](https://www.python.org/downloads/) (`python3` or `python`) is required, including npm installs.
|
|
28
|
+
- [OpenCode CLI](https://github.com/sst/opencode) is required for `llm` and `apply` steps. The expected executable is `opencode`; `opencode-cli` is also accepted for compatibility.
|
|
29
|
+
- [GitHub CLI (`gh`)](https://cli.github.com/manual/installation) is required only if you use PR creation via `gh_pr_create`.
|
|
30
30
|
|
|
31
31
|
## Quick start
|
|
32
32
|
|
package/package.json
CHANGED
package/pyproject.toml
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import json
|
|
4
|
-
import os
|
|
5
4
|
import pathlib
|
|
6
5
|
import re
|
|
7
6
|
import shutil
|
|
@@ -26,24 +25,14 @@ def sanitize_filename_component(value: str) -> str:
|
|
|
26
25
|
return cleaned.strip("-") or "value"
|
|
27
26
|
|
|
28
27
|
|
|
29
|
-
def prefer_opencode_cli_candidate(candidate: str) -> str:
|
|
30
|
-
path = pathlib.Path(candidate)
|
|
31
|
-
if path.name != "opencode":
|
|
32
|
-
return candidate
|
|
33
|
-
sibling = path.with_name("opencode-cli")
|
|
34
|
-
if sibling.exists() and os.access(sibling, os.X_OK):
|
|
35
|
-
return str(sibling)
|
|
36
|
-
return candidate
|
|
37
|
-
|
|
38
|
-
|
|
39
28
|
def resolve_opencode_executable() -> str:
|
|
29
|
+
opencode_path = shutil.which("opencode")
|
|
30
|
+
if opencode_path:
|
|
31
|
+
return opencode_path
|
|
40
32
|
cli_path = shutil.which("opencode-cli")
|
|
41
33
|
if cli_path:
|
|
42
34
|
return cli_path
|
|
43
|
-
|
|
44
|
-
if opencode_path:
|
|
45
|
-
return prefer_opencode_cli_candidate(opencode_path)
|
|
46
|
-
raise HookError("opencode is required but not installed")
|
|
35
|
+
raise HookError("opencode (or opencode-cli) is required but not installed")
|
|
47
36
|
|
|
48
37
|
|
|
49
38
|
def parse_opencode_json_run_output(raw: str) -> tuple[str | None, str]:
|