fix(cli): only claim uipath new scaffolds for langchain agents - #1069
vldcmp-uipath wants to merge 1 commit into
Conversation
bb51178 to
0fbab93
Compare
9c98643 to
eba8fe7
Compare
The `new` middleware returned `should_continue=False` for every call, so installing uipath-langchain made the base `uipath new` function scaffold unreachable (UiPath/uipath-python#1543). It now claims a scaffold only when the base CLI asks for one it can serve: `--type auto` (where a single installed integration is meant to win) or `--type agent --agent-framework langchain`. Every other case — `--type function`, or an agent scaffold for another framework — passes through to the next middleware. The gate compares with `==` rather than `is`, so callers passing plain strings (an older uipath, or a direct middleware call) still work. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
eba8fe7 to
e8f33bd
Compare
|
|
Superseded by UiPath/uipath-python#1886, which fixes #1543 entirely in the base CLI.
So this integration needs no changes at all — |



Important
Draft until UiPath/uipath-python#1886 is approved and
uipath2.14.15 is published. The middleware importsuipath._cli.models.project_types/uipath._cli.models.agent_frameworks, which only exist from 2.14.15. For dev-build validation and TestPyPI publishing, this PR temporarily pinsuipath==2.14.15.dev1018867615(the dev build of #1886) sourced from thetestpypiindex, withuv.lockresolved against it. Before marking ready for review: restore"uipath>=2.14.15, <2.15.0", drop the[tool.uv.sources]testpypi entry foruipath, and runuv lock.Problem
langgraph_new_middlewarereturnsshould_continue=Falseunconditionally, so installinguipath-langchainhijacksuipath newprocess-wide and the base function scaffold becomes unreachable (UiPath/uipath-python#1543). This also breaks theuip function new -l pypath, which delegates touipath newand expects a function project.Changes
project_type/agent_framework(forwarded byuipath newsince 2.14.15) and claims the command for--type auto(the default: an installed framework wins, preserving today's behaviour) and for--type agentwith thelangchainframework; everything else passes through to the base scaffold or another framework's integration.ProjectType.AGENT/AgentFramework.LANGCHAIN) preserve current behaviour when an olderuipathCLI calls with just the project name.!=rather than identity so callers passing plain strings gate correctly (the enums subclassstr).uipathfloor raised to 2.14.15.Behaviour with uipath >= 2.14.15
uipath new my-fn(or--type auto)uipath new my-fn --type functionuipath new my-agent --type agentuipath new x --type agent --agent-framework pydantic-aiTesting
tests/cli/test_new.py(7 new cases incl. plain-string gating and old-CLI default), mypy and ruff clean, run against the TestPyPI dev builduipath==2.14.15.dev1018867615.🤖 Generated with Claude Code
Development Package
uipath pack --nolockto get the latest dev build from this PR (requires version range).