Skip to content

Commit e954287

Browse files
fix: default srcDir to project root instead of non-existent src/ subdirectory (#530)
The package command failed with "Required project file not found: .../src" because resolveProjectPaths defaulted srcDir to 'src' relative to the agent code directory. Agent templates place source files directly in the agent directory (e.g. app/MyAgent/main.py), not in a src/ subdirectory. Fixes #311 Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f0dc82e commit e954287

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/lib/packaging/__tests__/helpers.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,9 @@ describe('resolveProjectPaths', () => {
247247

248248
beforeAll(() => {
249249
root = mkdtempSync(join(tmpdir(), 'helpers-resolve-'));
250-
// Create a minimal project structure with pyproject.toml
250+
// Create a minimal project structure with pyproject.toml (source files live alongside it)
251251
writeFileSync(join(root, 'pyproject.toml'), '[project]\nname = "test"');
252-
mkdirSync(join(root, 'src'), { recursive: true });
252+
writeFileSync(join(root, 'main.py'), 'print("hello")');
253253
});
254254

255255
afterAll(() => {
@@ -260,7 +260,7 @@ describe('resolveProjectPaths', () => {
260260
const paths = await resolveProjectPaths({ projectRoot: root });
261261
expect(paths.projectRoot).toBe(root);
262262
expect(paths.pyprojectPath).toBe(join(root, 'pyproject.toml'));
263-
expect(paths.srcDir).toBe(join(root, 'src'));
263+
expect(paths.srcDir).toBe(root);
264264
});
265265

266266
it('uses agent name for build directory', async () => {

src/lib/packaging/helpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export async function resolveProjectPaths(options: PackageOptions = {}, agentNam
122122
const pyprojectPath = candidatePyproject;
123123

124124
const projectRoot = options.projectRoot ? resolve(options.projectRoot) : dirname(pyprojectPath);
125-
const srcDir = resolve(projectRoot, options.srcDir ?? 'src');
125+
const srcDir = resolve(projectRoot, options.srcDir ?? '.');
126126
const artifactDir = resolve(options.artifactDir ?? join(projectRoot, CONFIG_DIR));
127127

128128
// Simplified staging structure: <artifactDir>/<name>/staging
@@ -261,7 +261,7 @@ export function resolveProjectPathsSync(options: PackageOptions = {}, agentName?
261261

262262
const pyprojectPath = candidatePyproject;
263263
const projectRoot = options.projectRoot ? resolve(options.projectRoot) : dirname(pyprojectPath);
264-
const srcDir = resolve(projectRoot, options.srcDir ?? 'src');
264+
const srcDir = resolve(projectRoot, options.srcDir ?? '.');
265265
const artifactDir = resolve(options.artifactDir ?? join(projectRoot, CONFIG_DIR));
266266

267267
// Simplified staging structure: <artifactDir>/<name>/staging

0 commit comments

Comments
 (0)