Skip to content

fix: default srcDir to project root instead of non-existent src/ subdirectory#530

Merged
jesseturner21 merged 1 commit intomainfrom
worktree-fix-package-311
Mar 11, 2026
Merged

fix: default srcDir to project root instead of non-existent src/ subdirectory#530
jesseturner21 merged 1 commit intomainfrom
worktree-fix-package-311

Conversation

@jesseturner21
Copy link
Contributor

Description

The agentcore package command fails with Error: Required project file not found: .../app/MyAgent/src because resolveProjectPaths and resolveProjectPathsSync in helpers.ts default srcDir to 'src' relative to the agent's code directory. However, all agent templates (Strands, LangChain, CrewAI, GoogleADK, OpenAIAgents) place source files directly in the agent directory (e.g. app/MyAgent/main.py), not in a src/ subdirectory.

The fix changes the default from 'src' to '.' so that srcDir correctly resolves to the agent code directory itself. The srcDir option in PackageOptions still allows callers to override this if needed.

Related Issue

Closes #311

Documentation PR

N/A — no documentation changes needed.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Other (please describe):

Testing

How have you tested the change?

  • I ran npm run test:unit and npm run test:integ
  • I ran npm run typecheck
  • I ran npm run lint
  • If I modified src/assets/, I ran npm run test:update-snapshots and committed the updated snapshots

End-to-end manual testing:

  • agentcore create --name TestAgent --defaultsagentcore package → produces valid zip with main.py, model/, mcp_client/ at the root
  • agentcore create with --framework LangChain_LangGraphagentcore package → produces valid zip
  • Added a second agent via agentcore add agentagentcore package → both agents packaged successfully
  • agentcore package --agent <name> → works for individual agent targeting
  • agentcore validate → passes on all test projects

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.

…irectory

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>
@jesseturner21 jesseturner21 requested a review from a team March 10, 2026 20:22
@github-actions github-actions bot added the size/xs PR size: XS label Mar 10, 2026
@github-actions
Copy link
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 42.74% 3810 / 8913
🔵 Statements 42.32% 4017 / 9491
🔵 Functions 44.04% 740 / 1680
🔵 Branches 44.77% 2527 / 5644
Generated in workflow #935 for commit 2fe5b66 by the Vitest Coverage Report Action

@tejaskash tejaskash changed the title fix: package command fails looking for non-existent src/ directory fix: default srcDir to project root instead of non-existent src/ subdirectory Mar 10, 2026
Copy link
Contributor

@tejaskash tejaskash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@jesseturner21 jesseturner21 merged commit e954287 into main Mar 11, 2026
20 of 22 checks passed
@jesseturner21 jesseturner21 deleted the worktree-fix-package-311 branch March 11, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/xs PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Package command completly broken

2 participants