Skip to content

Comments

(outdated) feat: add comprehensive pdd setup prompts for all LLM providers (#480)#483

Closed
niti-go wants to merge 17 commits intopromptdriven:mainfrom
niti-go:change/issue-480
Closed

(outdated) feat: add comprehensive pdd setup prompts for all LLM providers (#480)#483
niti-go wants to merge 17 commits intopromptdriven:mainfrom
niti-go:change/issue-480

Conversation

@niti-go
Copy link
Contributor

@niti-go niti-go commented Feb 10, 2026

This draft PR is outdated and will be deleted soon, see #544 for the new PR.

Summary (as of 2/17)

Restructures pdd setup from a menu-driven interactive menu into a streamlined automatic configuration flow. Makes it easier for users to setup quickly with little to no manual configuration required. Allows users to set up local LLMs and other less common providers.

Phase 1 — CLI Bootstrap: Detects installed agentic CLI tools (claude, gemini, codex), cross-references with available API keys, and offers to install a matching CLI if one isn't found. Required for pdd fix, pdd change, and pdd bug to work.

Phase 2 — Auto-Configuration (4 deterministic steps):

  1. Scans API keys across shell environment, .env, and ~/.pdd/api-env.* — shows source transparency per key; prompts to add one if none found
  2. Configures models by matching found keys against a bundled reference CSV and writing matching entries to ~/.pdd/llm_model.csv
  3. Checks for local LLMs (Ollama, LM Studio) and offers to create .pddrc with auto-detected language defaults
  4. Tests a model and prints a summary of what was configured

New Python Modules

  • pdd/api_key_scanner.py — multi-source key discovery with source attribution (no values stored)
  • pdd/cli_detector.py — agentic CLI detection and bootstrap
  • pdd/litellm_registry.py — browse/search LiteLLM's provider registry with pricing data
  • pdd/model_tester.py — interactive model test with API key status and timing diagnostics
  • pdd/pddrc_initializer.py — project .pddrc creation with language auto-detection
  • pdd/setup/provider_manager.py — add/remove providers via registry search or custom entry; atomic CSV updates; safe key commenting

New Example Files (context/)

  • api_key_scanner_example.py, cli_detector_example.py, litellm_registry_example.py, model_tester_example.py, - pddrc_initializer_example.py, provider_manager_example.py, setup_tool_example.py — runnable demonstrations of each module

The PR also has corresponding test and prompt files.

Documentation

  • docs/SETUP_GUIDE.md — new comprehensive reference covering all setup flows, API key priority, smart storage rules, CI/CD guidance, and troubleshooting
  • README.md, SETUP_WITH_GEMINI.md, docs/ONBOARDING.md — updated to describe the two-phase flow and point to the new guide

…ptdriven#480)

Create 7 new prompts to transform pdd setup into a comprehensive system bootstrapper
that supports dynamic provider discovery, API key management, and interactive model
selection across all LLM providers.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
niti-go and others added 6 commits February 10, 2026 22:50
- Delete model_selector_python.prompt and its example: interactive tier
  selection removed; adding a provider now auto-loads all its models
- Delete api_key_validator_python.prompt and its example: replaced by
  model_tester which tests individual models via litellm.completion()
  directly instead of steering llm_invoke with PDD_MODEL_DEFAULT
- Create model_tester_python.prompt and example: new "Test a model" menu
  option using litellm.completion() with direct api_key param, showing
  diagnostics, timing, and cost per call
- Create cli_detector_python.prompt and example: new "Detect CLI tools"
  menu option leveraging get_available_agents() from agentic_common,
  cross-referencing API keys with installed CLIs
- Rewrite setup_tool_python.prompt: new 6-option menu (Add provider,
  Remove models, Test model, Detect CLI, Init .pddrc, Done) with
  sub-menus, replacing the old 5-option flow that ended in model selection
- Rewrite provider_manager_python.prompt: new functions add_api_key
  (auto-loads all models), remove_models_by_provider (comments out keys),
  and remove_individual_models, replacing add_or_fix_keys/remove_provider
- Trim all prompts per prompting guide: remove implementation patterns,
  keep behavioral requirements, target 10-30% prompt-to-code ratio
- Store files in /pdd/setup, rather than main directory /pdd
- Modify utils.py command to run pdd setup at the new correct file path
- Still needs refinement on prompts + code to further improve interface,  but is functional
- Still needs example files and test files
@niti-go

This comment was marked as outdated.

@gltanaka gltanaka marked this pull request as ready for review February 15, 2026 21:48
@gltanaka gltanaka marked this pull request as draft February 15, 2026 21:48
niti-go and others added 6 commits February 15, 2026 19:28
- Show LiteLLM registry of providers and models when adding models rather than data/llm_model.csv
- Add search feature to search for a provider
- Ask user for API keys based on the models they want to add
- Fixed misleading "local — no key required" message: Changed to "(no key configured)" in yellow, since an empty api_key field doesn't necessarily mean local—it could mean the user skipped entering the env var name, and litellm will fall back to its own defaults.
- Expanded provider → API key mapping: Added 30 new providers to PROVIDER_API_KEY_MAP (including moonshot → MOONSHOT_API_KEY), so the setup flow now knows which env var to prompt for when users add models from lesser-known providers.
- Fixed a shell escaping bug in provider_manager.py discovered by the new tests: changed _save_key_to_api_env to use shlex.quote() instead of simple double-quoting, which was breaking API keys containing special characters like $, ", ', and backticks
- Immediate session availability: API keys are now loaded into os.environ when saved, allowing users to test models immediately within the same pdd setup session without restarting their shell
- Automatic shell RC integration: The source line (source ~/.pdd/api-env.{shell}) is automatically added to the user's shell startup file (~/.zshrc, ~/.bashrc, etc.) with shell-appropriate syntax, so new terminal sessions have the API keys available without manual configuration
- Created 4 comprehensive test files (165 tests total) for the new setup modules: test_api_key_scanner.py, test_litellm_registry.py, test_provider_manager.py, and test_cli_detector.py — including rigorous shell execution tests that actually run bash/zsh to verify API key escaping works correctly
- Starts by boostrapping agentic CLI
- Then utomatically scans for API keys, populates llm_model.csv, checks for local LLMs, initializes .pddrc, and tests a model
- Removed /setup directory, all setup-related files now exist in root /pdd directory
- Users mostly just need to hit 'enter' to finish setup
- Add testing files
I split this into a 4-step agentic task, but later I realized it's more reliable to do setup deterministically right now.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR restructures the PDD setup from a menu-driven system to a two-phase automatic configuration flow designed for minimal user friction. Phase 1 bootstraps an agentic CLI (Claude/Gemini/Codex) interactively. Phase 2 runs deterministic auto-configuration that scans API keys, configures models, checks local LLMs, and initializes .pddrc.

Changes:

  • Replaces manual menu system with automatic CLI detection and streamlined configuration
  • Adds 7 new Python modules for modular setup functionality
  • Implements comprehensive API key scanning with source transparency
  • Adds local LLM detection (Ollama, LM Studio)
  • Complete test coverage rewrite from integration tests to unit tests

Reviewed changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
pdd/provider_manager.py New module for provider management with registry search and CSV operations
pdd/cli_detector.py New CLI detection and bootstrapping with interactive installation
pdd/litellm_registry.py New LiteLLM registry wrapper for provider/model discovery
pdd/model_tester.py New interactive model testing with diagnostics
pdd/pddrc_initializer.py New .pddrc file creation with language detection
pdd/api_key_scanner.py New API key scanner with multi-source detection
pdd/core/utils.py Updated import path for setup_tool module
tests/* Complete rewrite of tests from integration to unit tests
pdd/prompts/* New prompt files for all modules
context/* New example files demonstrating module usage
docs/* Updated documentation for new setup flow

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

niti-go and others added 4 commits February 18, 2026 11:18
- Adds support for many more LiteLLM-supported providers (Vertex AI, AWS Bedrock, Azure, etc.)
- The api_key column now supports pipe-delimited fields (e.g. VERTEXAI_PROJECT|VERTEXAI_LOCATION|GOOGLE_APPLICATION_CREDENTIALS) for providers whose auth requires multiple credentials
- Updated pdd setup documentation
- Update llm_invoke api_key handling to support the new pipe-delimited credentials format and generalized to remove provider-specific logic
@niti-go niti-go closed this Feb 20, 2026
@niti-go niti-go changed the title feat: add comprehensive pdd setup prompts for all LLM providers (#480) (outdated) feat: add comprehensive pdd setup prompts for all LLM providers (#480) Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant