Skip to content

fix(cli): add .adk/ to the .gitignore generated by adk create - #6649

Closed
chelsealong wants to merge 1 commit into
google:mainfrom
chelsealong:fix-adk-create-gitignore-adk-dir
Closed

fix(cli): add .adk/ to the .gitignore generated by adk create#6649
chelsealong wants to merge 1 commit into
google:mainfrom
chelsealong:fix-adk-create-gitignore-adk-dir

Conversation

@chelsealong

Copy link
Copy Markdown
Contributor

Summary

adk create generates an agent-level .gitignore, but it only adds .env.
When local storage is enabled, ADK writes runtime data into .adk/ inside
the agent directory (e.g. .adk/session.db, .adk/artifacts/). Since
.adk/ wasn't in the generated .gitignore, this local session database
and artifacts could be committed accidentally.

This generalizes the existing .gitignore helper (previously
.env-only, added in #5427) to ensure both .env and .adk/ are present,
while preserving existing behavior:

  • Preserves existing .gitignore entries.
  • Adds any missing generated-file entries (.env, .adk/).
  • Does not duplicate entries that already exist.

Fixes#6647

Testing plan

Updated/added unit tests in
tests/unittests/cli/utils/test_cli_create.py covering: a fresh
.gitignore, an existing .gitignore missing both entries, one missing
only .adk/, and one that already has both (no duplication).

Ran:

pytest tests/unittests/cli/utils/test_cli_create.py -v

Result: 31 passed.

Verified the new/updated assertions fail against the pre-fix code (using
git checkout HEAD~1 -- src/google/adk/cli/cli_create.py to restore the
prior version of the source file, then re-running the suite): 5 failed,
26 passed, confirming the tests exercise the fix. Restored the fix with
git checkout HEAD -- src/google/adk/cli/cli_create.py and confirmed the
suite is back to 31 passed.

Also confirmed formatting with pyink (no diffs) on both changed files.

AI assistance disclosure

This PR was authored with the assistance of an AI coding agent (Claude),
under human supervision review before submission.

adk create only added .env to the generated agent-level .gitignore.
Local storage writes runtime data (session db, artifacts) under
.adk/, which was left untracked-but-committable. Generalize the
gitignore helper to ensure both .env and .adk/ are present, while
preserving existing entries and avoiding duplicates.
Fixesgoogle#6647
@adk-botadk-bot added the core [Component] This issue is related to the core interface and implementation label Aug 8, 2026
copybara-serviceBot pushed a commit that referenced this pull request Aug 12, 2026
@adk-bot

Copy link
Copy Markdown
Collaborator

Thank you @chelsealong for your contribution! 🎉

Your changes have been successfully imported and merged via Copybara in commit 374aab3.

Closing this PR as the changes are now in the main branch.

@adk-botadk-bot added the merged [Status] This PR is merged label Aug 12, 2026
@adk-botadk-bot closed this Aug 12, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core[Component] This issue is related to the core interface and implementationmerged[Status] This PR is merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add .adk/ to the .gitignore generated by adk create

3 participants

@chelsealong@adk-bot@DeanChensj