fix(cli): stop uipath init on an unscaffolded Studio Web project - #1905
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Handle valid project.uiproj JSON whose root is not an object to avoid an unhandled exception.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Updates uipath init to detect unscaffolded Studio Web projects without writing files, adds regression tests, and bumps the version to 2.14.23.
Changes:
- Detects bare
project.uiprojdirectories and suggestsuipath new. - Normalizes project names and ignores hidden entries.
- Adds initialization guard tests.
- Updates package and lockfile versions.
File summaries
| File | Summary |
|---|---|
packages/uipath/uv.lock |
Synchronizes the locked package version. |
packages/uipath/tests/cli/test_init.py |
Adds tests for the initialization guard. |
packages/uipath/src/uipath/_cli/cli_init.py |
Adds scaffold detection and project-name normalization. |
packages/uipath/pyproject.toml |
Updates the package version. |
Review details
- Files reviewed: 3/4 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
a7adc91 to
5952a24
Compare
5952a24 to
051418f
Compare
| if not visible_entries <= {UIPROJ_FILE}: | ||
| return |
There was a problem hiding this comment.
I didn't know sets have this operator and had too look it up. I find visible_entries.issubset({UIPROJ_FILE}) easier to understand, but it's still not immediately clear what we're checking.
I would make the cases explicit in the next if, since it checks for empty vs singleton set anyway:
if not visible_entries:
reason = "this directory is empty."
elif visible_entries == {UIPROJ_FILE}:
...
else:
returnThere was a problem hiding this comment.
indeed, i have changed it
Studio Web's cloud-workspace flow creates a folder holding only `project.uiproj`. Running `uipath init` there wrote `.env`, `uipath.json`, `bindings.json` and `entry-points.json` before crashing on the missing `pyproject.toml`, leaving the project half-initialised. `init` now checks for that state before writing anything and exits with an actionable message pointing at `uipath new <name>`, where the name is taken from `project.uiproj` and normalized to a valid project name. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
b409647 to
7c4504e
Compare
🚨 Heads up:
|
|



Problem
Studio Web's cloud-workspace flow hands you a folder containing only
project.uiproj. Runninguipath initthere wrote.env,uipath.json,bindings.jsonandentry-points.json, then crashed with an unhandledFileNotFoundErroron the missingpyproject.toml. The project was left half-initialised, with emptyfunctions/agentsmaps and no source file.Fix
initnow checks for that state before writing anything. Whenproject.uiprojis the only visible entry in the directory, it exits with an actionable message instead:project.uiproj→Nameand normalized to a valid PEP 508 project name (lowercased, invalid runs collapsed to-). Falls back touipath new <name>when no name is available..uipath,.git,.env, ...) are ignored when deciding whether the directory is still the bare template.pyproject.toml, so the same template folder can still become a JS project.Tests
Added to
tests/cli/test_init.py:Nameis missingproject.uiprojalongside real sources still initializes normallyVersion
uipath2.14.22 → 2.14.23🤖 Generated with Claude Code