[PR #361] Add include_prompts_in_repositories whitelist for prompt storage #424

Closed
opened 2026-03-02 04:13:35 +03:00 by kerem · 0 comments
Owner

Original Pull Request: https://github.com/git-ai-project/git-ai/pull/361

State: closed
Merged: No


Summary

  • Adds include_prompts_in_repositories config option to whitelist repositories for enterprise prompt storage (CAS)
  • Adds default_prompt_storage config option to specify fallback storage mode for non-whitelisted repos
  • Adds PromptStorageMode enum for type-safe handling of storage modes
  • Updates effective_prompt_storage() resolver to handle the new whitelist logic with proper precedence

Motivation

This enables two common use cases:

User A (wants git-ai everywhere, CAS for work repos, notes for OSS):

{
  "prompt_storage": "default",
  "include_prompts_in_repositories": ["https://github.com/myorg/*"],
  "default_prompt_storage": "notes"
}

User B (wants git-ai only for work repos with CAS):

{
  "prompt_storage": "default",
  "allow_repositories": ["https://github.com/myorg/*"],
  "include_prompts_in_repositories": ["*"]
}

Changes

  • src/config.rs: Added PromptStorageMode enum, new config fields, effective_prompt_storage() resolver, and tests
  • src/authorship/post_commit.rs: Updated to use new effective_prompt_storage() resolver
  • src/commands/config.rs: Added CLI support for get/set/unset of new config options

Test plan

  • Added unit tests for PromptStorageMode::from_str() and as_str()
  • Added unit tests for effective_prompt_storage() covering:
    • No include list uses global prompt_storage (legacy behavior)
    • Exclude list always wins (returns Local)
    • Wildcard include matches repos without remotes
    • Non-wildcard include with no match uses fallback
    • No fallback configured defaults to Local
    • Pattern matching works correctly
  • All existing tests pass

🤖 Generated with Claude Code

**Original Pull Request:** https://github.com/git-ai-project/git-ai/pull/361 **State:** closed **Merged:** No --- ## Summary - Adds `include_prompts_in_repositories` config option to whitelist repositories for enterprise prompt storage (CAS) - Adds `default_prompt_storage` config option to specify fallback storage mode for non-whitelisted repos - Adds `PromptStorageMode` enum for type-safe handling of storage modes - Updates `effective_prompt_storage()` resolver to handle the new whitelist logic with proper precedence ## Motivation This enables two common use cases: **User A** (wants git-ai everywhere, CAS for work repos, notes for OSS): ```json { "prompt_storage": "default", "include_prompts_in_repositories": ["https://github.com/myorg/*"], "default_prompt_storage": "notes" } ``` **User B** (wants git-ai only for work repos with CAS): ```json { "prompt_storage": "default", "allow_repositories": ["https://github.com/myorg/*"], "include_prompts_in_repositories": ["*"] } ``` ## Changes - `src/config.rs`: Added `PromptStorageMode` enum, new config fields, `effective_prompt_storage()` resolver, and tests - `src/authorship/post_commit.rs`: Updated to use new `effective_prompt_storage()` resolver - `src/commands/config.rs`: Added CLI support for get/set/unset of new config options ## Test plan - [x] Added unit tests for `PromptStorageMode::from_str()` and `as_str()` - [x] Added unit tests for `effective_prompt_storage()` covering: - No include list uses global prompt_storage (legacy behavior) - Exclude list always wins (returns Local) - Wildcard include matches repos without remotes - Non-wildcard include with no match uses fallback - No fallback configured defaults to Local - Pattern matching works correctly - [x] All existing tests pass 🤖 Generated with [Claude Code](https://claude.ai/claude-code)
kerem 2026-03-02 04:13:35 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/git-ai#424
No description provided.