Skip to content

fix(cli): refuse to overwrite an existing project in uipath new - #2042

Draft
rge-uipath wants to merge 2 commits into
mainfrom
fix/new-refuse-overwrite
Draft

rge-uipath wants to merge 2 commits into
mainfrom
fix/new-refuse-overwrite

Conversation

@rge-uipath

@rge-uipath rge-uipath commented Dec 4, 2026 •

Copy link
Copy Markdown

uipath new <name> (function projects) silently replaced an existing main.py, pyproject.toml and uipath.json. Now, if any exists in the target directory, nothing is written and it exits 1 via console.error, naming the existing files: "Run uipath new in an empty folder, or pass --force to overwrite." Agent-framework scaffolds are guarded separately (companion: UiPath/uipath-langchain-python#1268).

New --force flag keeps the old in-place overwrite for function projects. It is not forwarded to agent-framework new middlewares: they take only name, are called directly by uipath new, and live in other packages, so forwarding would be a cross-package signature change.

Tests: test_new_project_with_existing_files (previously asserted the overwrite) now asserts the refusal and untouched file; new test_new_project_with_existing_files_force_overwrites asserts --force exits 0 and overwrites. Patch version bumped (2.15.16).

Verified from packages/uipath: uv run pytest tests/cli/test_new.py tests/cli/test_job_token.py tests/cli/eval/test_eval_util.py --no-cov, uv run ruff check, uv run ruff format, uv run mypy src/uipath/_cli/cli_new.py.

🤖 Generated with Claude Code

Running `uipath new <name>` for a function project in a folder that already
had main.py, pyproject.toml or uipath.json silently replaced them. Exit 1
naming the existing files instead.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@github-actions github-actions Bot added test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-runtime test:uipath-integrations labels Dec 4, 2026
@sonarqubecloud

sonarqubecloud Bot commented Dec 4, 2026

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:uipath-integrations test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant