OpenSpec icon indicating copy to clipboard operation
OpenSpec copied to clipboard

[Fix] Use openspec update directly in config apply-now

Open alfred-openspec opened this issue 4 months ago • 1 comments

Context

Reported in #1304 by @BenNewman100. After openspec config profile saves profile/workflow changes and the user confirms "Apply changes to this project now?", OpenSpec shells out through npx openspec update. That fails for Bun global installs and standalone binary installs where openspec is available on PATH but npx is not.

Root Cause

  • src/commands/config.ts imports execSync and calls execSync('npx openspec update', { stdio: 'inherit', cwd: projectDir }) in the interactive apply-now path.
  • The UX and fallback message already tell users to run openspec update, so the implementation is inconsistent with the supported non-npm installation paths.
  • The focused regression in test/commands/config-profile.test.ts currently asserts the hardcoded npx command, so it will need to be updated.

Proposed Fix

  1. Replace the apply-now command with openspec update instead of npx openspec update.
  2. Update test/commands/config-profile.test.ts to expect execSync('openspec update', { stdio: 'inherit', cwd: fs.realpathSync(tempDir) }).
  3. Run the focused test: pnpm test test/commands/config-profile.test.ts.

Files to Modify

  • src/commands/config.ts
  • test/commands/config-profile.test.ts

Closes #1304

alfred-openspec avatar Jul 04 '26 07:07 alfred-openspec

Closing as fixed by #1351 (commit a0eb70e), which went one step further than proposed: the apply-now path calls new UpdateCommand().execute(projectDir) in-process (src/commands/config.ts:625), so there is no shell-out at all. npx, PATH, and Bun users are now equally unbothered.

On main, ships with the next release.

clay-good avatar Jul 22 '26 18:07 clay-good