-
Notifications
You must be signed in to change notification settings - Fork 18
Labels
console:cliConsole commands and CLI interfaceConsole commands and CLI interfaceenhancementNew feature or requestNew feature or request
Milestone
Description
Currently, ctx init creates a hardcoded configuration with a fixed src directory structure. This requires manual customization for different project types and frameworks, creating friction for new users and inconsistent setups across teams.
// Current hardcoded approach in InitCommand.php
firstSource: new TreeSource(
sourcePaths: ['src'], // Always 'src' - not flexible
treeView: new TreeViewConfig(
showCharCount: true,
),
),Proposed Solution
Transform ctx init into an intelligent system supporting:
- Template-based initialization:
ctx init laravelusing predefined templates - Smart project analysis:
ctx initwith automatic project type detection
Core Components
Template Configuration Format (YAML):
# templates/laravel.yaml
name: "Laravel"
description: "Laravel PHP Framework project template"
tags: ["php", "laravel", "web", "framework"]
priority: 10
detection:
files: ["composer.json", "artisan"]
patterns: ["laravel/framework"]
documents:
- description: "Laravel Application Overview"
outputPath: "docs/laravel-overview.md"
sources:
- type: tree
sourcePaths: ["app", "database", "routes", "config"]
- type: file
sourcePaths: ["app/Http/Controllers", "app/Models"]
filePattern: "*.php"
modifiers: ["php-signature"]Smart Project Analysis:
ComposerAnalyzer: Detects Laravel/Symfony/other PHP frameworksPackageJsonAnalyzer: Detects React/Vue/Node.js projectsDirectoryStructureAnalyzer: Fallback based on folder patternsGitAnalyzer: Analyzes .gitignore and repository patterns
Command Usage Examples
# List available templates
ctx init --list-templates
# Use specific template
ctx init laravel
ctx init react
ctx init --template=symfony
# Smart analysis mode (default)
ctx init
# Output: "Detected Laravel project (95% confidence)
# Use Laravel template? [Y/n]"Built-in Templates
Initial templates to include:
laravel- Laravel PHP frameworksymfony- Symfony PHP frameworkreact- React.js applicationvue- Vue.js applicationspiral- Spiral PHP frameworkgeneric-php- Generic PHP projectgeneric-node- Generic Node.js project
Benefits
- Zero Configuration: Works out-of-the-box for common project types
- Consistent Structure: Standardized context generation across teams
- Extensible: Easy to add new templates and analyzers via bootloader system
- Educational: Users learn best practices through templates
- Framework Integration: Follows existing CTX patterns (Registry, Factory, Bootloader)
Metadata
Metadata
Assignees
Labels
console:cliConsole commands and CLI interfaceConsole commands and CLI interfaceenhancementNew feature or requestNew feature or request
Type
Projects
Status
Done