fix(cli): add .adk/ to the .gitignore generated by adk create - #6649
Open
chelsealong wants to merge 1 commit into
Open
fix(cli): add .adk/ to the .gitignore generated by adk create#6649chelsealong wants to merge 1 commit into
chelsealong wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
adk creategenerates an agent-level.gitignore, but it only adds.env.When local storage is enabled, ADK writes runtime data into
.adk/insidethe agent directory (e.g.
.adk/session.db,.adk/artifacts/). Since.adk/wasn't in the generated.gitignore, this local session databaseand artifacts could be committed accidentally.
This generalizes the existing
.gitignorehelper (previously.env-only, added in #5427) to ensure both.envand.adk/are present,while preserving existing behavior:
.gitignoreentries..env,.adk/).Fixes #6647
Testing plan
Updated/added unit tests in
tests/unittests/cli/utils/test_cli_create.pycovering: a fresh.gitignore, an existing.gitignoremissing both entries, one missingonly
.adk/, and one that already has both (no duplication).Ran:
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.pyto restore theprior 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.pyand confirmed thesuite 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.