Summary
Implement a new execution flow for the Titan CLI that prioritizes configuration verification at both global and local levels, including an interactive setup wizard for first-time users.
Description
Currently, the initialization process for Titan needs to be more structured. This feature changes the startup logic so that Titan automatically detects the environment state. It will check for a global configuration first; if missing, it will guide the user through a setup wizard. Once a global configuration is established, it will then ensure the current project directory is properly configured before proceeding with execution.
This solves the problem of "unconfigured" states and improves the onboarding experience for new users.
Objectives
- [Objective 1: Ensure a valid global configuration exists before any CLI operations.]
- [Objective 2: Automate the detection of local (project-level) configurations.]
- [Objective 3: Provide a user-friendly interactive wizard for initial setup.]
- [Objective 4: Streamline the transition from a fresh install to a project-ready state.]
Proposed Solution
Modify the CLI entry point to follow this logic:
- Check Global Config: Look for a configuration file in the user's home directory (e.g.,
~/.titan/config).
- Global Wizard: If no global config is found, launch an interactive setup wizard to generate it.
- Check Local Config: Once global config is confirmed, look for a configuration file in the current working directory (e.g.,
./titan.json or .titan.yaml).
- Local Setup: If no local config is found, prompt the user to configure Titan for the current project.
Implementation Phases
Phase 1: Configuration Discovery Logic
- Implement the search logic for global and local configuration files.
- Define the precedence rules for settings.
Phase 2: Interactive Setup Wizard
- Create the CLI prompt interface for global settings (API keys, preferences, etc.).
- Implement file generation logic for the global config file.
Phase 3: Project Initialization
- Implement the logic to detect and initialize project-specific settings if they are missing.
- Ensure the CLI can proceed to main execution once both layers are verified.
Tasks
Acceptance Criteria
Testing Strategy
Unit Tests:
- Test
find_global_config() with mocked file systems.
- Test
find_local_config() in various directory structures.
Integration Tests:
- Mock the wizard input to ensure it generates a valid config file.
- Verify that the CLI execution flow pauses for configuration and resumes correctly.
Manual Testing:
- Delete all Titan configs and run the tool to verify the wizard starts.
- Run Titan in a new project folder to verify the local setup prompt.
Considerations
- Backwards compatibility: Ensure existing global configs are recognized and not overwritten.
- Environment Variables: Consider if environment variables should override these configuration files.
- Silent Mode: Provide a flag (e.g.,
--non-interactive) to skip wizards in CI/CD environments.
Code Snippets (Optional)
N/A
Summary
Implement a new execution flow for the Titan CLI that prioritizes configuration verification at both global and local levels, including an interactive setup wizard for first-time users.
Description
Currently, the initialization process for Titan needs to be more structured. This feature changes the startup logic so that Titan automatically detects the environment state. It will check for a global configuration first; if missing, it will guide the user through a setup wizard. Once a global configuration is established, it will then ensure the current project directory is properly configured before proceeding with execution.
This solves the problem of "unconfigured" states and improves the onboarding experience for new users.
Objectives
Proposed Solution
Modify the CLI entry point to follow this logic:
~/.titan/config)../titan.jsonor.titan.yaml).Implementation Phases
Phase 1: Configuration Discovery Logic
Phase 2: Interactive Setup Wizard
Phase 3: Project Initialization
Tasks
ConfigManagerto handle file detection.InquirerorQuestionary.Acceptance Criteria
titanfor the first time triggers the global setup wizard.Testing Strategy
Unit Tests:
find_global_config()with mocked file systems.find_local_config()in various directory structures.Integration Tests:
Manual Testing:
Considerations
--non-interactive) to skip wizards in CI/CD environments.Code Snippets (Optional)
N/A