Skip to content

Commit a29c52c

Browse files
JonZeollaclaude
andcommitted
feat(hooks): use ZENABLE_NONINTERACTIVE and simplify post-gen hook
Replace ZENABLE_YES with ZENABLE_NONINTERACTIVE env var for clarity. The installer scripts now handle integrations in non-interactive mode, so remove the post-install PATH manipulation and second binary lookup. When zenable is already installed, pass -y to zenable install. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4b3aaff commit a29c52c

1 file changed

Lines changed: 6 additions & 22 deletions

File tree

hooks/post_gen_project.py

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def _install_zenable_binary() -> bool:
199199
200200
Returns True if installation succeeded, False otherwise.
201201
"""
202-
env = {**os.environ, "ZENABLE_YES": "1"}
202+
env = {**os.environ, "ZENABLE_NONINTERACTIVE": "1"}
203203

204204
try:
205205
metadata = _fetch_release_metadata()
@@ -270,30 +270,14 @@ def opportunistically_install_zenable_tools() -> None:
270270
LOG.warning("Zenable CLI could not be installed.")
271271
return
272272

273-
# The installer updates PATH for future shells/steps (e.g. via
274-
# GITHUB_PATH or the user's shell profile) but not the current
275-
# process. Add the default install directory so we can find the
276-
# binary immediately.
277-
zenable_bin_dir = str(Path.home() / ".zenable" / "bin")
278-
os.environ["PATH"] = zenable_bin_dir + os.pathsep + os.environ.get("PATH", "")
279-
280-
zenable_bin = _find_zenable_binary()
281-
if not zenable_bin:
282-
# Diagnostic: log what the installer actually created
283-
zenable_dir = Path.home() / ".zenable"
284-
if zenable_dir.exists():
285-
contents = [str(p.relative_to(zenable_dir)) for p in zenable_dir.rglob("*")]
286-
LOG.warning("Install dir %s contents: %s", zenable_dir, contents)
287-
else:
288-
LOG.warning("Install directory does not exist: %s", zenable_dir)
289-
LOG.warning("Current PATH: %s", os.environ.get("PATH", ""))
290-
LOG.warning("Zenable CLI was installed but could not be found in PATH or default location.")
291-
return
273+
# The installer runs in non-interactive mode (ZENABLE_NONINTERACTIVE=1)
274+
# and handles both binary installation and IDE integrations automatically.
275+
return
292276

293-
# Zenable CLI is available, attempt to configure IDE integrations
277+
# Zenable CLI is already installed, just configure IDE integrations
294278
LOG.debug("Zenable CLI found at %s, configuring IDE integrations...", zenable_bin)
295279
try:
296-
subprocess.run([zenable_bin, "install"], check=True, timeout=60)
280+
subprocess.run([zenable_bin, "install", "-y"], check=True, timeout=60)
297281
print("\n" + "=" * 70)
298282
print("Successfully configured the Zenable AI coding guardrails 🚀")
299283
print("To start using it, just open the IDE of your choice, login, and you're all set 🤖")

0 commit comments

Comments
 (0)