Skip to content

Commit d44cd6a

Browse files
cosmyoclaude
andcommitted
refactor: simplify init middleware to generate AGENTS.md and CLAUDE.md only
- Restore AGENTS.md generation from uipath_langchain._resources - Remove generation of .agent/ reference docs (these are now handled by the uipath-claude-plugins repo) - Update AGENTS.md content to remove references to removed sub-docs - CLAUDE.md continues to be generated from uipath._resources (@AGENTS.md) - Bump version to 0.7.7 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 9a58c20 commit d44cd6a

5 files changed

Lines changed: 23 additions & 193 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.8.4"
3+
version = "0.8.5"
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: 2 additions & 8 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,9 @@ 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 = [
8986
(target_directory, "CLAUDE.md", "uipath._resources"),
90-
(agent_dir, "CLI_REFERENCE.md", "uipath._resources"),
91-
(agent_dir, "SDK_REFERENCE.md", "uipath._resources"),
9287
(target_directory, "AGENTS.md", "uipath_langchain._resources"),
93-
(agent_dir, "REQUIRED_STRUCTURE.md", "uipath_langchain._resources"),
9488
]
9589

9690
for directory, file_name, resource_name in file_configs:

src/uipath_langchain/_resources/AGENTS.md

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,4 @@
22

33
This document provides practical code patterns for building UiPath coded agents using LangGraph and the UiPath Python SDK.
44

5-
---
6-
7-
## Documentation Structure
8-
9-
This documentation is split into multiple files for efficient context loading. Load only the files you need:
10-
11-
1. **@.agent/REQUIRED_STRUCTURE.md** - Agent structure patterns and templates
12-
- **When to load:** Creating a new agent or understanding required patterns
13-
- **Contains:** Required Pydantic models (Input, State, Output), LLM initialization patterns, standard agent template
14-
15-
2. **@.agent/SDK_REFERENCE.md** - Complete SDK API reference
16-
- **When to load:** Calling UiPath SDK methods, working with services (actions, assets, jobs, etc.)
17-
- **Contains:** All SDK services and methods with full signatures and type annotations
18-
19-
3. **@.agent/CLI_REFERENCE.md** - CLI commands documentation
20-
- **When to load:** Working with `uipath init`, `uipath run`, or `uipath eval` commands
21-
- **Contains:** Command syntax, options, usage examples, and workflows
5+
Run with: `uipath run main '{...}'`

src/uipath_langchain/_resources/REQUIRED_STRUCTURE.md

Lines changed: 0 additions & 92 deletions
This file was deleted.

tests/cli/test_init.py

Lines changed: 19 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ 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 AGENTS.md file."""
1616
with tempfile.TemporaryDirectory() as temp_dir:
1717
result = generate_agent_md_file(
1818
temp_dir, "AGENTS.md", "uipath_langchain._resources", False
@@ -27,7 +27,7 @@ def test_generate_file_success(self):
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."""
@@ -49,26 +49,7 @@ def test_file_already_exists(self):
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."""
@@ -95,54 +76,33 @@ 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_agents_and_claude_md(self):
80+
"""Test that AGENTS.md and CLAUDE.md are generated (without .agent/ sub-docs)."""
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 results for AGENTS.md and CLAUDE.md
85+
assert len(results) == 2
10586
file_names = [name for name, _ in results]
10687
assert "AGENTS.md" in file_names
107-
assert "REQUIRED_STRUCTURE.md" in file_names
10888
assert "CLAUDE.md" in file_names
109-
assert "CLI_REFERENCE.md" in file_names
110-
assert "SDK_REFERENCE.md" in file_names
11189

112-
# Check all were created (not updated or skipped)
90+
# Should NOT create .agent directory
91+
assert not os.path.exists(os.path.join(temp_dir, ".agent"))
92+
93+
# Check files were 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-
12097
agents_md_path = os.path.join(temp_dir, "AGENTS.md")
12198
assert os.path.exists(agents_md_path)
12299

123-
required_structure_path = os.path.join(agent_dir, "REQUIRED_STRUCTURE.md")
124-
assert os.path.exists(required_structure_path)
125-
126100
with open(agents_md_path, "r") as f:
127101
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)
139-
140-
results = list(generate_specific_agents_md_files(temp_dir, False))
141-
assert len(results) == 5
142-
assert os.path.exists(agent_dir)
102+
assert "LangGraph" in agents_content
143103

144104
def test_files_overwritten(self):
145-
"""Test that existing files are overwritten."""
105+
"""Test that existing AGENTS.md is overwritten."""
146106
with tempfile.TemporaryDirectory() as temp_dir:
147107
agents_md_path = os.path.join(temp_dir, "AGENTS.md")
148108
original_content = "Custom documentation"
@@ -151,7 +111,7 @@ def test_files_overwritten(self):
151111

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

154-
# Check that AGENTS.md was updated, others were created
114+
# Check that AGENTS.md was updated
155115
agents_result = [r for r in results if r[0] == "AGENTS.md"]
156116
assert len(agents_result) == 1
157117
_, status = agents_result[0]
@@ -161,42 +121,26 @@ def test_files_overwritten(self):
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 AGENTS.md is skipped when no_agents_md_override is True."""
168128
with tempfile.TemporaryDirectory() as temp_dir:
169-
# Create some existing files
129+
# Create existing AGENTS.md
170130
agents_md_path = os.path.join(temp_dir, "AGENTS.md")
171-
claude_md_path = os.path.join(temp_dir, "CLAUDE.md")
172131
with open(agents_md_path, "w") as f:
173132
f.write("Existing AGENTS.md")
174-
with open(claude_md_path, "w") as f:
175-
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
]
185142
assert "AGENTS.md" in skipped_files
186-
assert "CLAUDE.md" in skipped_files
187-
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
197143

198-
# Verify the existing files were not modified
144+
# Verify the existing file was not modified
199145
with open(agents_md_path, "r") as f:
200146
assert f.read() == "Existing AGENTS.md"
201-
with open(claude_md_path, "r") as f:
202-
assert f.read() == "Existing CLAUDE.md"

0 commit comments

Comments
 (0)