Skip to content

Set up the workspace on the first run when npm blocked the install script - #33

Merged
beharguy merged 1 commit into
mainfrom
fix/first-run-setup
Sep 25, 2026
Merged

beharguy merged 1 commit into
mainfrom
fix/first-run-setup

Conversation

@beharguy

Copy link
Copy Markdown
Contributor

Why

Recent npm versions do not run a package's install scripts until the user approves them (npm warn install-scripts … not yet covered by allowScripts). On such a machine a fresh npm i -D @uidxkit/uidx succeeds, but the postinstall never runs: no .uidx/, no uidx / uidx:mcp scripts, no .mcp.json entry, no skills. The documented next step, npm run uidx, does not exist, and npx uidx dev stopped with "No uidx workspace found". Reported from a Windows machine on 0.1.5.

What changes

  • uidx dev (and uidx open on a directory) inside an npm project with no workspace now runs the same initProject setup the postinstall performs, then serves, and prints what it added. OpenResult.initialized carries the project root so the CLI can say so.
  • A directory with no package.json above it still gets the uidx init hint, and a setup failure (for example a taken script name) is reported with the --script advice.
  • READMEs explain npm's approval prompt, the npm install-scripts approve @uidxkit/uidx alternative, and that the first run sets things up; changelog entry under Unreleased.

Verification

  • New tests in open.test.ts: first run sets up a fresh npm project (manifest, welcome page, scripts) and serves; a non-project directory is refused; an existing workspace reports initialized: null. The init.test.ts expectation for the missing-workspace message moved to the non-project case.
  • CLI suite passes (122 tests), type check, ESLint and Prettier clean.
  • Packed tarball installed with --ignore-scripts (what a blocked postinstall looks like), then npx uidx dev --no-open: the workspace, scripts and skills are created and the server starts.

🤖 Generated with Claude Code

…did not run

Recent npm versions block a package's install scripts until they are
approved, so on a fresh install the postinstall that created `.uidx/`, the
`uidx` npm scripts, the `.mcp.json` entry and the skills never ran, and
`npx uidx dev` dead-ended with "No uidx workspace found".

`uidx dev` inside an npm project with no workspace now performs that same
setup itself and reports what it added; a directory that is not an npm
project still gets the `uidx init` hint. The READMEs describe npm's approval
prompt and the `npm install-scripts approve` alternative.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@beharguy
beharguy merged commit 8d242cb into main Sep 25, 2026
5 checks passed
@beharguy
beharguy deleted the fix/first-run-setup branch September 25, 2026 11:00
@beharguy beharguy mentioned this pull request Sep 25, 2026
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.

1 participant