Skip to content

Commit 0208ee6

Browse files
cosmyoclaude
andcommitted
refactor: simplify init middleware to only generate CLAUDE.md
- Simplify LangGraph init middleware to only generate CLAUDE.md - Add dedicated CLAUDE.md resource for LangGraph projects - Skills are now handled by the separate uipath-claude-plugins repo - Bump version to 0.7.7 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a8da676 commit 0208ee6

4 files changed

Lines changed: 48 additions & 106 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath-langchain"
3-
version = "0.7.6"
3+
version = "0.7.7"
44
description = "Python SDK that enables developers to build and deploy LangGraph agents to the UiPath Cloud Platform"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"

src/uipath_langchain/_cli/cli_init.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ def generate_agent_md_file(
7070
def generate_specific_agents_md_files(
7171
target_directory: str, no_agents_md_override: bool
7272
) -> Generator[tuple[str, FileOperationStatus], None, None]:
73-
"""Generate agent-specific files from the packaged resource.
73+
"""Generate CLAUDE.md file from the packaged resource.
7474
7575
Args:
76-
target_directory: The directory where the files should be created.
76+
target_directory: The directory where the file should be created.
7777
no_agents_md_override: Whether to override existing files.
7878
7979
Yields:
@@ -82,15 +82,8 @@ def generate_specific_agents_md_files(
8282
- UPDATED: File was overwritten
8383
- SKIPPED: File exists and was not overwritten
8484
"""
85-
agent_dir = os.path.join(target_directory, ".agent")
86-
os.makedirs(agent_dir, exist_ok=True)
87-
8885
file_configs = [
89-
(target_directory, "CLAUDE.md", "uipath._resources"),
90-
(agent_dir, "CLI_REFERENCE.md", "uipath._resources"),
91-
(agent_dir, "SDK_REFERENCE.md", "uipath._resources"),
92-
(target_directory, "AGENTS.md", "uipath_langchain._resources"),
93-
(agent_dir, "REQUIRED_STRUCTURE.md", "uipath_langchain._resources"),
86+
(target_directory, "CLAUDE.md", "uipath_langchain._resources"),
9487
]
9588

9689
for directory, file_name, resource_name in file_configs:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# UiPath LangGraph Agent Project
2+
3+
This is a UiPath coded agent project using LangGraph and the UiPath Python SDK.
4+
5+
Run with: `uipath run main '{...}'`

tests/cli/test_init.py

Lines changed: 39 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -12,78 +12,59 @@ class TestGenerateAgentMdFile:
1212
"""Tests for the generate_agent_md_file function."""
1313

1414
def test_generate_file_success(self):
15-
"""Test successfully generating an agent MD file."""
15+
"""Test successfully generating CLAUDE.md file."""
1616
with tempfile.TemporaryDirectory() as temp_dir:
1717
result = generate_agent_md_file(
18-
temp_dir, "AGENTS.md", "uipath_langchain._resources", False
18+
temp_dir, "CLAUDE.md", "uipath_langchain._resources", False
1919
)
2020
assert result is not None
2121
file_name, status = result
22-
assert file_name == "AGENTS.md"
22+
assert file_name == "CLAUDE.md"
2323
assert status == FileOperationStatus.CREATED
2424

25-
target_path = os.path.join(temp_dir, "AGENTS.md")
25+
target_path = os.path.join(temp_dir, "CLAUDE.md")
2626
assert os.path.exists(target_path)
2727
with open(target_path, "r") as f:
2828
content = f.read()
2929
assert len(content) > 0
30-
assert "Agent Code Patterns Reference" in content
30+
assert "LangGraph" in content
3131

3232
def test_file_already_exists(self):
3333
"""Test that an existing file is overwritten."""
3434
with tempfile.TemporaryDirectory() as temp_dir:
35-
target_path = os.path.join(temp_dir, "AGENTS.md")
35+
target_path = os.path.join(temp_dir, "CLAUDE.md")
3636
original_content = "Original content"
3737
with open(target_path, "w") as f:
3838
f.write(original_content)
3939

4040
result = generate_agent_md_file(
41-
temp_dir, "AGENTS.md", "uipath_langchain._resources", False
41+
temp_dir, "CLAUDE.md", "uipath_langchain._resources", False
4242
)
4343
assert result is not None
4444
file_name, status = result
45-
assert file_name == "AGENTS.md"
45+
assert file_name == "CLAUDE.md"
4646
assert status == FileOperationStatus.UPDATED
4747

4848
with open(target_path, "r") as f:
4949
content = f.read()
5050

5151
assert content != original_content
52-
assert "Agent Code Patterns Reference" in content
53-
54-
def test_generate_required_structure_file(self):
55-
"""Test generating REQUIRED_STRUCTURE.md file."""
56-
with tempfile.TemporaryDirectory() as temp_dir:
57-
agent_dir = os.path.join(temp_dir, ".agent")
58-
os.makedirs(agent_dir, exist_ok=True)
59-
result = generate_agent_md_file(
60-
agent_dir, "REQUIRED_STRUCTURE.md", "uipath_langchain._resources", False
61-
)
62-
assert result is not None
63-
file_name, status = result
64-
assert file_name == "REQUIRED_STRUCTURE.md"
65-
assert status == FileOperationStatus.CREATED
66-
67-
target_path = os.path.join(agent_dir, "REQUIRED_STRUCTURE.md")
68-
assert os.path.exists(target_path)
69-
with open(target_path, "r") as f:
70-
content = f.read()
71-
assert "Required Agent Structure" in content
52+
assert "LangGraph" in content
7253

7354
def test_file_skipped_when_no_override(self):
7455
"""Test that an existing file is skipped when no_agents_md_override is True."""
7556
with tempfile.TemporaryDirectory() as temp_dir:
76-
target_path = os.path.join(temp_dir, "AGENTS.md")
57+
target_path = os.path.join(temp_dir, "CLAUDE.md")
7758
original_content = "Original content"
7859
with open(target_path, "w") as f:
7960
f.write(original_content)
8061

8162
result = generate_agent_md_file(
82-
temp_dir, "AGENTS.md", "uipath_langchain._resources", True
63+
temp_dir, "CLAUDE.md", "uipath_langchain._resources", True
8364
)
8465
assert result is not None
8566
file_name, status = result
86-
assert file_name == "AGENTS.md"
67+
assert file_name == "CLAUDE.md"
8768
assert status == FileOperationStatus.SKIPPED
8869

8970
# Verify the file was not modified
@@ -95,108 +76,71 @@ def test_file_skipped_when_no_override(self):
9576
class TestGenerateSpecificAgentsMdFiles:
9677
"""Tests for the generate_specific_agents_md_files function."""
9778

98-
def test_generate_all_files(self):
99-
"""Test that all agent documentation files are generated."""
79+
def test_generate_only_claude_md(self):
80+
"""Test that only CLAUDE.md is generated."""
10081
with tempfile.TemporaryDirectory() as temp_dir:
10182
results = list(generate_specific_agents_md_files(temp_dir, False))
10283

103-
# Check that we got results for all files
104-
assert len(results) == 5
84+
# Check that we got result only for CLAUDE.md
85+
assert len(results) == 1
10586
file_names = [name for name, _ in results]
106-
assert "AGENTS.md" in file_names
107-
assert "REQUIRED_STRUCTURE.md" in file_names
10887
assert "CLAUDE.md" in file_names
109-
assert "CLI_REFERENCE.md" in file_names
110-
assert "SDK_REFERENCE.md" in file_names
11188

112-
# Check all were created (not updated or skipped)
89+
# Should NOT create AGENTS.md or .agent directory
90+
assert not os.path.exists(os.path.join(temp_dir, "AGENTS.md"))
91+
assert not os.path.exists(os.path.join(temp_dir, ".agent"))
92+
93+
# Check it was created (not updated or skipped)
11394
for _, status in results:
11495
assert status == FileOperationStatus.CREATED
11596

116-
agent_dir = os.path.join(temp_dir, ".agent")
117-
assert os.path.exists(agent_dir)
118-
assert os.path.isdir(agent_dir)
119-
120-
agents_md_path = os.path.join(temp_dir, "AGENTS.md")
121-
assert os.path.exists(agents_md_path)
122-
123-
required_structure_path = os.path.join(agent_dir, "REQUIRED_STRUCTURE.md")
124-
assert os.path.exists(required_structure_path)
125-
126-
with open(agents_md_path, "r") as f:
127-
agents_content = f.read()
128-
assert "Agent Code Patterns Reference" in agents_content
129-
130-
with open(required_structure_path, "r") as f:
131-
required_content = f.read()
132-
assert "Required Agent Structure" in required_content
133-
134-
def test_agent_dir_already_exists(self):
135-
"""Test that the existing .agent directory doesn't cause errors."""
136-
with tempfile.TemporaryDirectory() as temp_dir:
137-
agent_dir = os.path.join(temp_dir, ".agent")
138-
os.makedirs(agent_dir, exist_ok=True)
97+
claude_md_path = os.path.join(temp_dir, "CLAUDE.md")
98+
assert os.path.exists(claude_md_path)
13999

140-
results = list(generate_specific_agents_md_files(temp_dir, False))
141-
assert len(results) == 5
142-
assert os.path.exists(agent_dir)
100+
with open(claude_md_path, "r") as f:
101+
claude_content = f.read()
102+
assert "LangGraph" in claude_content
143103

144104
def test_files_overwritten(self):
145-
"""Test that existing files are overwritten."""
105+
"""Test that existing CLAUDE.md is overwritten."""
146106
with tempfile.TemporaryDirectory() as temp_dir:
147-
agents_md_path = os.path.join(temp_dir, "AGENTS.md")
107+
claude_md_path = os.path.join(temp_dir, "CLAUDE.md")
148108
original_content = "Custom documentation"
149-
with open(agents_md_path, "w") as f:
109+
with open(claude_md_path, "w") as f:
150110
f.write(original_content)
151111

152112
results = list(generate_specific_agents_md_files(temp_dir, False))
153113

154-
# Check that AGENTS.md was updated, others were created
155-
agents_result = [r for r in results if r[0] == "AGENTS.md"]
156-
assert len(agents_result) == 1
157-
_, status = agents_result[0]
114+
# Check that CLAUDE.md was updated
115+
claude_result = [r for r in results if r[0] == "CLAUDE.md"]
116+
assert len(claude_result) == 1
117+
_, status = claude_result[0]
158118
assert status == FileOperationStatus.UPDATED
159119

160-
with open(agents_md_path, "r") as f:
120+
with open(claude_md_path, "r") as f:
161121
content = f.read()
162122

163123
assert content != original_content
164-
assert "Agent Code Patterns Reference" in content
124+
assert "LangGraph" in content
165125

166126
def test_files_skipped_when_no_override(self):
167-
"""Test that existing files are skipped when no_agents_md_override is True."""
127+
"""Test that existing CLAUDE.md is skipped when no_agents_md_override is True."""
168128
with tempfile.TemporaryDirectory() as temp_dir:
169-
# Create some existing files
170-
agents_md_path = os.path.join(temp_dir, "AGENTS.md")
129+
# Create existing CLAUDE.md
171130
claude_md_path = os.path.join(temp_dir, "CLAUDE.md")
172-
with open(agents_md_path, "w") as f:
173-
f.write("Existing AGENTS.md")
174131
with open(claude_md_path, "w") as f:
175132
f.write("Existing CLAUDE.md")
176133

177134
results = list(generate_specific_agents_md_files(temp_dir, True))
178135

179-
# Check that existing files were skipped
136+
# Check that existing file was skipped
180137
skipped_files = [
181138
name
182139
for name, status in results
183140
if status == FileOperationStatus.SKIPPED
184141
]
185-
assert "AGENTS.md" in skipped_files
186142
assert "CLAUDE.md" in skipped_files
187143

188-
# Check that non-existing files were created
189-
created_files = [
190-
name
191-
for name, status in results
192-
if status == FileOperationStatus.CREATED
193-
]
194-
assert "CLI_REFERENCE.md" in created_files
195-
assert "SDK_REFERENCE.md" in created_files
196-
assert "REQUIRED_STRUCTURE.md" in created_files
197-
198-
# Verify the existing files were not modified
199-
with open(agents_md_path, "r") as f:
200-
assert f.read() == "Existing AGENTS.md"
144+
# Verify the existing file was not modified
201145
with open(claude_md_path, "r") as f:
202146
assert f.read() == "Existing CLAUDE.md"

0 commit comments

Comments
 (0)