Skip to content

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

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

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

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.

Fixes google#6647
@adk-bot adk-bot added the core [Component] This issue is related to the core interface and implementation label Aug 8, 2026
Sign up for free to 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 implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants