Skip to content

fix: restore executable permission on bin entries after tsc build#452

Merged
jackwener merged 1 commit intomainfrom
fix/build-permission-denied-446
Mar 26, 2026
Merged

fix: restore executable permission on bin entries after tsc build#452
jackwener merged 1 commit intomainfrom
fix/build-permission-denied-446

Conversation

@jackwener
Copy link
Copy Markdown
Owner

Problem

npm run build causes Permission denied when running opencli afterwards.

Root cause: The build pipeline runs clean-dist (deletes entire dist/), then tsc regenerates all files — but TypeScript compiler does not set executable permissions on output files. So dist/main.js ends up with -rw-r--r-- (644) instead of -rwxr-xr-x (755).

Fix

At the end of build-manifest.ts main() (the last step in the build pipeline), read bin entries from package.json and chmod 0o755 them.

  • Zero new files — no extra scripts needed
  • Cross-platform — skipped on Windows (process.platform !== 'win32')
  • Best-effort — wrapped in try/catch, never breaks the build
  • Not hardcoded — reads from package.json bin field

Closes #446

tsc does not preserve the +x bit when compiling, so after clean-dist
removes dist/ and tsc regenerates it, dist/main.js loses its executable
permission. This causes 'Permission denied' when users run 'npm run build'
in the installed directory.

Fix: read bin entries from package.json at the end of build-manifest and
chmod 0o755 them (skipped on Windows). Wrapped in try/catch so it never
breaks the build.

Closes #446
@jackwener jackwener merged commit 4e5b00b into main Mar 26, 2026
18 checks passed
@jackwener jackwener deleted the fix/build-permission-denied-446 branch March 26, 2026 03:59
jackwener added a commit to HzTTT/opencli that referenced this pull request Mar 26, 2026
…ckwener#446) (jackwener#452)

tsc does not preserve the +x bit when compiling, so after clean-dist
removes dist/ and tsc regenerates it, dist/main.js loses its executable
permission. This causes 'Permission denied' when users run 'npm run build'
in the installed directory.

Fix: read bin entries from package.json at the end of build-manifest and
chmod 0o755 them (skipped on Windows). Wrapped in try/catch so it never
breaks the build.

Closes jackwener#446
jackwener added a commit to hanxiao790/opencli that referenced this pull request Mar 26, 2026
…ckwener#446) (jackwener#452)

tsc does not preserve the +x bit when compiling, so after clean-dist
removes dist/ and tsc regenerates it, dist/main.js loses its executable
permission. This causes 'Permission denied' when users run 'npm run build'
in the installed directory.

Fix: read bin entries from package.json at the end of build-manifest and
chmod 0o755 them (skipped on Windows). Wrapped in try/catch so it never
breaks the build.

Closes jackwener#446
jackwener added a commit that referenced this pull request Mar 26, 2026
* fix(ci): include popup assets in extension release

Copy popup assets into the packaged Chrome extension zip and validate that manifest-referenced files exist before publishing the artifact.

Co-authored-by: Codex <noreply@openai.com>

* fix: restore executable permission on bin entries after tsc build (#446) (#452)

tsc does not preserve the +x bit when compiling, so after clean-dist
removes dist/ and tsc regenerates it, dist/main.js loses its executable
permission. This causes 'Permission denied' when users run 'npm run build'
in the installed directory.

Fix: read bin entries from package.json at the end of build-manifest and
chmod 0o755 them (skipped on Windows). Wrapped in try/catch so it never
breaks the build.

Closes #446

* fix: correct positional arg usage in tests (#449)

* fix yahoo-finance quote e2e invocation

* fix positional args in v2ex topic tests

* fix(ci): script extension release packaging

---------

Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: jakevin <jakevingoo@gmail.com>
Co-authored-by: pi-dal <hi@pi-dal.com>
jackwener added a commit to Xeron2000/opencli that referenced this pull request Mar 26, 2026
* fix(ci): include popup assets in extension release

Copy popup assets into the packaged Chrome extension zip and validate that manifest-referenced files exist before publishing the artifact.

Co-authored-by: Codex <noreply@openai.com>

* fix: restore executable permission on bin entries after tsc build (jackwener#446) (jackwener#452)

tsc does not preserve the +x bit when compiling, so after clean-dist
removes dist/ and tsc regenerates it, dist/main.js loses its executable
permission. This causes 'Permission denied' when users run 'npm run build'
in the installed directory.

Fix: read bin entries from package.json at the end of build-manifest and
chmod 0o755 them (skipped on Windows). Wrapped in try/catch so it never
breaks the build.

Closes jackwener#446

* fix: correct positional arg usage in tests (jackwener#449)

* fix yahoo-finance quote e2e invocation

* fix positional args in v2ex topic tests

* fix(ci): script extension release packaging

---------

Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: jakevin <jakevingoo@gmail.com>
Co-authored-by: pi-dal <hi@pi-dal.com>
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.

npm run build for TS adapter causes Permission denied error for the opencli command

1 participant