Skip to content

Forge scripts ship without executable bit — blocks afx spawn on fresh installs #693

@waleedkadous

Description

@waleedkadous

The forge concept scripts at `scripts/forge/github/*.sh` (and the gitlab/gitea variants) are installed by the `@cluesmith/codev` npm package without the executable bit set. This causes `afx spawn` to fail with `Permission denied` when fetching the GitHub issue during builder spawn.

Repro

  1. Install `@cluesmith/codev` via npm/brew
  2. `afx spawn 1 --protocol spir` against any issue

Expected

Builder spawns, issue is fetched via `issue-view` concept command.

Actual

```
[info] No spec file found. Protocol allows spawning without one (Specify phase will create it).
[error] Failed to fetch issue #1. Ensure the 'issue-view' forge concept command is configured
(default: 'gh' CLI must be installed and authenticated). Configure forge commands in .codev/config.json
if using a non-GitHub forge.
```

With `CODEV_DEBUG=1`:
```
[forge] concept 'issue-view' failed: Command failed:
/opt/homebrew/lib/node_modules/@cluesmith/codev/scripts/forge/github/issue-view.sh
/bin/sh: /opt/homebrew/lib/node_modules/@cluesmith/codev/scripts/forge/github/issue-view.sh: Permission denied
```

File permissions in the shipped package:
```
-rw-r--r-- 1 mwk admin 200 ... scripts/forge/github/issue-view.sh
```

Fix options

  1. Simplest: mark the shell scripts as executable in the repo (`chmod +x scripts/forge/**/*.sh` + commit) — npm preserves the executable bit for files tracked in git with `100755` mode.
  2. Alternative: add a postinstall hook to set the bit, but this creates work on every install and is unnecessary if option 1 is used.
  3. Alternative: change the dispatcher in `dist/lib/forge.js` to invoke `sh <script>` instead of executing directly — works around the bit but hides the underlying packaging issue.

Option 1 is the right fix. The scripts all start with `#!/bin/sh` and contain an `exec` call — they are clearly intended to run as standalone executables.

Impact

Blocks `afx spawn` for any numbered issue on fresh installs. Affects `issue-view`, `issue-list`, `issue-comment`, `pr-*`, etc. — everything routed through `executeForgeCommand`.

Workaround

`chmod +x /opt/homebrew/lib/node_modules/@cluesmith/codev/scripts/forge/**/*.sh` — works but regresses on every `codev` package update.

Context

Encountered on iaser.ai setup, codev v2 (after the af → afx rename). Reported by the architect agent during issue-#3 spawn.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions