Skip to content

Added the 'drevops/vortex-cli' CLI package built on 'drevops/tui' for installing and configuring Vortex projects.#2828

Open
AlexSkrypnyk wants to merge 149 commits into
2.xfrom
feature/customizer-tui
Open

Added the 'drevops/vortex-cli' CLI package built on 'drevops/tui' for installing and configuring Vortex projects.#2828
AlexSkrypnyk wants to merge 149 commits into
2.xfrom
feature/customizer-tui

Conversation

@AlexSkrypnyk

@AlexSkrypnyk AlexSkrypnyk commented Jul 22, 2026

Copy link
Copy Markdown
Member

Summary

Introduces the drevops/vortex-cli package at .vortex/cli: a Symfony Console application (the vortex binary, built into a PHAR) that installs and configures projects generated from the Vortex Drupal template. Interactive collection is delegated to drevops/tui (^0.1), a panel-based terminal form engine developed in-tree on this branch and then extracted to its own repository and released on Packagist, which supports both an interactive TUI and a headless JSON mode for scripted or agent-driven use. The CLI's prompt handlers are the installer's existing prompt handlers ported verbatim, with a single TuiAdapter layer translating that handler contract into TUI form elements, and a VortexForm owning panel structure, question order, conditional gating, derived values and processing weights. Against the current 2.x, the change is purely additive: it adds the new package, its test fixtures, and two GitHub Actions workflows, without modifying or deleting any existing file.

Changes

CLI application

  • Added the .vortex/cli package (drevops/vortex-cli, PHP >=8.3) with the vortex bin, built via composer build (Box) into a PHAR.
  • Added install, configure, doctor and update commands plus a default RouterCommand that resolves a bare vortex to install or configure based on directory state.
  • ConfigureCommand supports --schema (emits the question set as JSON Schema), --agent-help, --validate (checks an answer set against the schema), headless --prompts (a JSON string or file path) with per-question VORTEX_<ID> environment overrides, --update to enable discovery, and --apply to run processing against the target directory.
  • Added the Downloader subsystem (Archiver, Artifact, RepositoryDownloader) for fetching and extracting the template repository archive, a FileManager, and utility classes (Config, File, Env, Converter, JsonManipulator, Version).

Form and handlers

  • Added Form/VortexForm, which owns the panel structure (general, drupal, code repository, environment, hosting, deployment, workflow, notifications, continuous integration, automations, documentation, ai), question order, conditional visibility (Condition), derived values (Derive), and the WEIGHTS processing-order map that reproduces the installer's runProcessors() sequence exactly.
  • Added Form/TuiAdapter as the single layer converting the handler contract (question kind, options, required flag, default, validate, transform, discover) into drevops/tui form elements, so handlers stay ignorant of the form builder.
  • Ported the installer's prompt handlers (.vortex/installer/src/Prompts/Handlers/*) into Handler/* verbatim, with only namespace and Utils swaps, keeping reflection-based ids, type inference, response accessors and process() side effects identical.
  • The question set matches the installer's current 2.x state, including the Gitleaks secret-scanning question, the twig_cs_fixer development tool and the navigation_extra_tools module option, so both tools collect the same 39 answers.
  • Added the missing class and method docblocks on the ported handlers, split the over-long VortexForm condition array, and scoped phpstan.neon to exclude the verbatim installer relocations the same way the existing Utils and Downloader exclusions already do, keeping composer lint (phpcs, phpstan, rector) fully green.

Processing

  • Added Process/Processor, which applies collected answers in ascending weight order (ties broken by reverse form order, so specific replacements run before generic ones) and interleaves the field-less dotenv and internal processors that always run first and last.

Tests and fixtures

  • Added functional handler tests under tests/phpunit/Functional/Handlers/* mirroring the installer's fixture harness: a _baseline project scaffold plus per-dataset overlays under tests/phpunit/Fixtures/handler_process, regenerated through the package's own snapshot tooling and covering every handler, with the datasets kept in step with the installer's (gitleaks_enabled/gitleaks_disabled, tools_no_twig/tools_no_twig_circleci, modules_no_navigation_extra_tools).
  • Added command-level functional tests for configure, install, update, doctor, the router, and file handling, plus unit coverage for the Name handler.

CI wiring

  • Added .github/workflows/vortex-test-cli.yml, which runs composer lint and composer test against PHP 8.3 and 8.4, scoped to .vortex/cli/** and to this branch (it does not run on main yet, pending promotion of the package).
  • Added .github/workflows/vortex-release-cli.yml, which builds the PHAR with Box and attaches it to tag and manual-dispatch releases.

Before / After

 BEFORE                                     AFTER
 ┌─────────────────────────────────┐        ┌─────────────────────────────────┐
 │ .vortex/installer               │        │ .vortex/installer               │
 │  Prompts\Handlers\*             │        │  Prompts\Handlers\*             │
 │  linear, question-by-question   │        │  unchanged - still the source   │
 │  the only way to install        │        │  the handlers are ported from   │
 └─────────────────────────────────┘        └───────────────┬─────────────────┘
                                                            │ ported verbatim
                                                            ▼
      (no standalone CLI package)           ┌─────────────────────────────────┐
                                            │ .vortex/cli                     │
                                            │  (drevops/vortex-cli PHAR)      │
                                            │  vortex install | configure |   │
                                            │         update | doctor        │
                                            │  Handler\* (installer contract) │
                                            │  Form\TuiAdapter ── VortexForm  │
                                            │  Process\Processor (by weight)  │
                                            └───────────────┬─────────────────┘
                                                            │ drives
                                                            ▼
                                            ┌─────────────────────────────────┐
                                            │ drevops/tui (Packagist, ^0.1)   │
                                            │  panel TUI  |  headless JSON    │
                                            │  --prompts + VORTEX_<ID> env    │
                                            └─────────────────────────────────┘

working-directory: .vortex/cli

- name: Create Release
uses: softprops/action-gh-release@718ea10b132b3b2eba29c1007bb80653f286566b # v3
Comment on lines +43 to +44
- name: Checkout code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
@github-actions

This comment has been minimized.

@AlexSkrypnyk

This comment has been minimized.

1 similar comment
@AlexSkrypnyk

This comment has been minimized.

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown

📖 Documentation preview for this pull request has been deployed to Netlify:

https://6a6162088fdfc30a1b9134b3--vortex-docs.netlify.app

This preview is rebuilt on every commit and is not the production documentation site.

@AlexSkrypnyk AlexSkrypnyk added the Needs review Pull request needs a review from assigned developers label Jul 22, 2026
@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.07%. Comparing base (69a676e) to head (3d36633).

Additional details and impacted files
@@           Coverage Diff           @@
##              2.x    #2828   +/-   ##
=======================================
  Coverage   88.07%   88.07%           
=======================================
  Files          98       98           
  Lines        5376     5376           
  Branches        3        3           
=======================================
  Hits         4735     4735           
  Misses        641      641           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…old template and added the 'vortex-test-cli' workflow.
…framed the plan around a generic engine with CLI-provided handlers.
…he handler-hooks wording in 'Context', and the 'initials' transform name in 'Deriver'.
…h the pure-collector design and the actual test and CI layout.
…n, and let the 'Tui' constructor accept the 'Form' builder directly.
…epting 'Tui' construction and 'Tui::run()' mode routing.
…ve' validating its transform, the four discovery rules and 'Fixup'.
…uator' and 'Discovery' into them, and let fields declare 'default'/'validate'/'transform' closures winning over handler hooks.
…res and covered the declared-behaviour precedence with engine tests.
…tractHandler' removed, the registry now resolves consumer classes and discovers reusable static 'validate()'/'transform()' as the engine's fallback.
…exForm' closures, 'validate'/'transform' became reusable statics discovered by the engine, and 'ProcessorInterface' stands alone.
…referenced them from 'VortexForm' instead of string literals.
… handlers, replacing the inline option arrays in 'VortexForm'.
…ind the new 'FieldInterface', leaving 'VortexForm' as the panel structure and question order.
…he 'VortexForm::field()' adapter as the only code converting handler data into form elements, keeping handlers ignorant of the form builder.
…rInterface', 'AbstractHandler', 'PromptType' and all concrete handlers) and added the 'TuiAdapter' as the single layer converting the handler contract into TUI form elements; the engine now guards only supplied inputs, transforming before validating.
…password' (masked everywhere), 'search', 'multisearch' and 'pause' - covering all 'PromptType' cases, with builder methods, env coercion, schema validation and the CLI adapter arms.
…abel, kind, weight, panel trail) at collection time, so 'toSummary()' and the CLI 'Processor' no longer take the form configuration.
…nance' and 'Source' enums, and recorded the no-string-literals-for-closed-sets convention in AGENTS.md.
…idget example a self-contained program with the drive loop inlined.
… released 'drevops/tui' 0.1.0 from Packagist: the built form is a 'FormDefinition', multi-value questions use 'select()/search()' with 'multiple()', processing weights moved to the CLI-owned 'VortexForm::WEIGHTS', interactive aborts ('InterruptException') return failure, and the agent help is asserted as the JSON Schema it now emits.
…eaks' secret-scanning question (wired into the Continuous Integration panel and 'WEIGHTS'), the 'twig_cs_fixer' tool, and the 'navigation_extra_tools' module replacing 'admin_toolbar'.
…irrored the installer's test changes: new 'Gitleaks' and 'tools_no_twig' datasets, 'modules_no_navigation_extra_tools' replacing 'modules_no_admin_toolbar', 'twig_cs_fixer' joining the tools lists, dropped '.gitignore' migration asserts, and the schema question count at 39.
…ocblocks to the ported handlers, split the over-long condition array in 'VortexForm', scoped PHPStan to exclude the verbatim installer relocations like the existing 'Utils' and 'Downloader' exclusions, applied the Rector modernizations and narrowed the agent-help schema assertions.
@AlexSkrypnyk
AlexSkrypnyk force-pushed the feature/customizer-tui branch from 157fe35 to 3d36633 Compare July 23, 2026 00:22
@github-actions

Copy link
Copy Markdown

Code coverage (threshold: 90%)

  Classes: 100.00% (1/1)
  Methods: 100.00% (2/2)
  Lines:   100.00% (153/153)
Per-class coverage
Drupal\ys_demo\Plugin\Block\CounterBlock
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% ( 10/ 10)

@AlexSkrypnyk

This comment has been minimized.

2 similar comments
@AlexSkrypnyk

This comment has been minimized.

@AlexSkrypnyk

Copy link
Copy Markdown
Member Author

Code coverage (threshold: 90%)

  Classes: 100.00% (1/1)
  Methods: 100.00% (2/2)
  Lines:   100.00% (153/153)
Per-class coverage
Drupal\ys_demo\Plugin\Block\CounterBlock
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% ( 10/ 10)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs review Pull request needs a review from assigned developers

Projects

Status: BACKLOG

Development

Successfully merging this pull request may close these issues.

2 participants