Skip to content

fix: ensure bash scripts are executable out of the box (#11) - #17

Open
raza-khan0108 wants to merge 1 commit into
IBM:mainfrom
raza-khan0108:fix/executable-bash-scripts-ootb-11
Open

fix: ensure bash scripts are executable out of the box (#11)#17
raza-khan0108 wants to merge 1 commit into
IBM:mainfrom
raza-khan0108:fix/executable-bash-scripts-ootb-11

Conversation

@raza-khan0108

Copy link
Copy Markdown

Fix: Ensure bash scripts in templates are executable out-of-the-box (#11)

Summary

This PR resolves Issue #11 ([Bug]: Bash script not executable ootb), where AI agents and developers encountered permission errors such as:

(eval):1: permission denied: .specify/scripts/bash/setup-plan.sh

When project templates were initialized or extracted, script files often lacked POSIX execute permissions (+x) out-of-the-box (OOTB). This PR fixes the issue across three distinct layers: git tracking index permissions, GitHub Actions template release packaging, and the Specify CLI runtime post-processing.


Key Changes

1. Git Repository Tracking Permissions

Normalized git index file modes from 100644 (read/write non-executable) to 100755 (executable) for all bash scripts in scripts/bash/:

  • scripts/bash/check-prerequisites.sh
  • scripts/bash/common.sh
  • scripts/bash/create-new-feature.sh
  • scripts/bash/setup-plan.sh
  • scripts/bash/update-agent-context.sh

2. Release Archive Packaging Workflow

Updated .github/workflows/scripts/create-release-packages.sh to guarantee that any downloaded .zip template archive from GitHub Releases has executable permissions pre-configured:

  • Added an explicit normalization command right before creating each zip package in build_variant():
    find "$base_dir" -type f -name "*.sh" -exec chmod +x {} + 2>/dev/null || true

3. Specify CLI Core (__init__.py)

Enhanced ensure_executable_scripts() in src/iac_specify_cli/__init__.py:

  • Expanded Scope: Recursively searches and sets POSIX execute bits on all .sh scripts under both .specify and .speckit project directories (rather than strictly .specify/scripts).
  • Windows Tracker Fix: On Windows (os.name == "nt"), ensure_executable_scripts() now properly registers the chmod step as skipped in the Rich StepTracker. This prevents the progress spinner from hanging or remaining in an incomplete state during iac-specify init on Windows machines.

4. Test Suite Compatibility & Unit Tests

Updated tests/test_ensure_functions.py:

  • Added @pytest.mark.skipif(os.name == "nt", ...) decorators to POSIX permission assertion tests that cannot execute natively on Windows NTFS.
  • Added a new unit test (test_makes_sh_scripts_in_speckit_executable) to verify that scripts inside .speckit/ are made executable.
  • Updated test_tracker_reports_updated_count to accept "skipped" status on Windows and "done" on POSIX systems.

5. Versioning & Documentation

In accordance with AGENTS.md guidelines for changes touching __init__.py:

  • Bumped CLI version from 0.0.9 to 0.0.10 in pyproject.toml.
  • Added complete release notes under ## [0.0.10] - 2026-07-07 in CHANGELOG.md.

Related Issue

Closes #11


Verification & Testing

Git Mode Verification

Verified git index mode updates via git diff --cached --summary:

 mode change 100644 => 100755 scripts/bash/check-prerequisites.sh
 mode change 100644 => 100755 scripts/bash/common.sh
 mode change 100644 => 100755 scripts/bash/create-new-feature.sh
 mode change 100644 => 100755 scripts/bash/setup-plan.sh
 mode change 100644 => 100755 scripts/bash/update-agent-context.sh

Automated Unit Tests

Ran the full test suite across Windows and POSIX environments:

$ uv run pytest
======================= 330 passed, 3 skipped in 1.73s ========================
  • 0 failures, 330 passed, 3 skipped (POSIX-specific tests cleanly skipped on Windows).

Checklist

  • I have searched existing issues for duplicates.
  • My code follows the style guidelines and general practices in AGENTS.md.
  • I have updated the package version in pyproject.toml and documented changes in CHANGELOG.md.
  • I have added/updated unit tests verifying the fix across both POSIX and Windows platforms.
  • All automated unit tests pass locally.

Copilot AI review requested due to automatic review settings July 7, 2026 17:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Bash script not executable ootb

2 participants