Merged
Conversation
…resolution
Binary resolution now uses three live tiers:
Tier-1: {project}/.kcode/vendor/bin/{tool} (installed by kcode init)
Tier-2: {project}/vendor/bin/{tool} (project-local fallback)
Tier-3: global PATH (system-wide fallback)
Removes unreachable Phar::running() check that was dead code since
tool binaries are never bundled inside kcode.phar.
Generates a self-contained Composer manifest at .kcode/composer.json with dev-tool dependencies (phpunit, phpstan, php-cs-fixer, rector, psalm). Version constraints come from devkit.php → 'tools' key; falls back to KaririCode-certified defaults. Short-names (e.g. 'phpunit') are resolved to full Composer package names via an internal map. The generated .kcode/composer.json is then consumed by kcode init which runs 'composer install --working-dir=.kcode/' to populate .kcode/vendor/bin/.
Extracts Composer binary resolution from Devkit into a dedicated readonly class, honouring Single Responsibility Principle (ARFA 1.3 S1). Resolution order: 1. COMPOSER_BINARY env var (explicit override) 2. PATH via 'command -v composer' 3. Known global paths (/usr/local/bin/composer, /usr/bin/composer) 4. User-level Composer PHAR (~/.composer/composer) 5. Literal 'composer' fallback Always returns a single executable path — never a shell fragment — so proc_open array invocation is always safe (type-safety standard S14).
…sioning Adds installTools() which runs 'composer install --working-dir=.kcode/' to install dev tools into .kcode/vendor/bin/ after config generation. Changes: - Injects ComposerResolver via constructor default arg (DIP — S5) - Variable names follow naming policy: $context, $devkitDirectory, $composerManifestPath (ARFA naming standard — S16) - Removes resolveComposer() private method (extracted to ComposerResolver) - proc_open uses STDIN/STDOUT/STDERR constants with \ namespace prefix - @SInCE 1.0.0 added to all new public methods
InitCommand now receives MigrationDetector via constructor injection, matching the existing MigrateCommand pattern (DIP — ARFA 1.3 S5). Also extends the init flow with a Phase 2: installs dev tools via Devkit::installTools() after config generation. Use --skip-install to generate configs only (useful in CI / offline environments). bin/kcode wiring updated to pass new MigrationDetector() to InitCommand.
KcodeComposerGeneratorTest (5 cases): toolName, outputPath, default versions, user version overrides, config section, output newline. bin/build-phar.php: restored to lean build strategy — bundles only src/ and an inline PSR-4 autoloader. Tools install dynamically via kcode init, avoiding prohibitively slow Phar::compressFiles(GZ) on large vendor trees (documented pitfall #12 in devkit KI).
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.
No description provided.