diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml
new file mode 100644
index 0000000..5a474f6
--- /dev/null
+++ b/.github/workflows/phpstan.yml
@@ -0,0 +1,32 @@
+name: PHPStan
+
+on:
+ pull_request:
+ branches: [ main ]
+ workflow_dispatch:
+
+concurrency:
+ group: phpstan-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ phpstan:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Setup PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: "8.3"
+ coverage: none
+
+ - name: Validate composer.json
+ run: composer validate --no-interaction
+
+ - name: Install dependencies
+ run: composer install --no-interaction --prefer-dist --no-progress
+
+ - name: Run PHPStan
+ run: vendor/bin/phpstan analyse -c phpstan.neon --no-progress --memory-limit=1G
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..b0e102e
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,115 @@
+name: Release
+
+on:
+ push:
+ branches:
+ - main
+
+permissions:
+ contents: write
+
+env:
+ PHP_VERSION: '8.2'
+
+jobs:
+ build-and-release:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - name: Get version
+ id: version
+ run: |
+ # Get the latest tag on main
+ LAST_TAG=$(git describe --tags --abbrev=0 HEAD 2>/dev/null || echo "v0.0.0")
+
+ # Count commits since last tag
+ COMMITS=$(git rev-list $LAST_TAG..HEAD --count)
+
+ # If no commits since last tag, use the tag itself
+ if [ "$COMMITS" = "0" ]; then
+ echo "version=$LAST_TAG" >> $GITHUB_OUTPUT
+ else
+ # Extract major.minor from last tag
+ MAJOR_MINOR=$(echo $LAST_TAG | sed -E 's/^v([0-9]+\.[0-9]+).*/\1/')
+ # Create new patch version
+ echo "version=v${MAJOR_MINOR}.${COMMITS}" >> $GITHUB_OUTPUT
+ fi
+
+ echo "tag=div-${{ steps.version.outputs.version }}" >> $GITHUB_OUTPUT
+
+ - name: Setup PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: ${{ env.PHP_VERSION }}
+ extensions: phar
+ tools: composer:v2
+
+ - name: Install dependencies
+ run: composer install --no-interaction --prefer-dist
+
+ - name: Build PHAR
+ run: php -d phar.readonly=0 build/build-phar.php
+
+ - name: Test PHAR
+ run: |
+ php build/div.phar version
+ php build/div.phar --help
+
+ - name: Set up Python
+ uses: actions/setup-python@v5
+ with:
+ python-version: "3.11"
+
+ - name: Install Pandoc and LaTeX
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y pandoc texlive-xetex texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended
+
+ - name: Build PDF documentation
+ run: |
+ python scripts/build_pdf.py --output build/div-cli-${{ steps.version.outputs.version }}.pdf --title "Div CLI ${{ steps.version.outputs.version }}"
+
+ - name: Create Release
+ uses: softprops/action-gh-release@v2
+ with:
+ tag_name: ${{ steps.version.outputs.version }}
+ name: div CLI ${{ steps.version.outputs.version }}
+ body: |
+ ## div CLI ${{ steps.version.outputs.version }}
+
+ **divengine/cli** - Runtime CLI for the Divengine template ecosystem.
+
+ ### Installation
+
+ **Unix/macOS:**
+ ```bash
+ curl -sSL https://raw.githubusercontent.com/divengine/cli/${{ steps.version.outputs.version }}/install | php
+ ```
+
+ **Windows (with PHP):**
+ ```bash
+ php -r "copy('https://raw.githubusercontent.com/divengine/cli/${{ steps.version.outputs.version }}/install', 'div');"
+ ```
+
+ **Direct download:**
+ Download `div.phar` from the assets below and make it executable.
+
+ ### What's new
+
+ See [CHANGELOG](https://github.com/divengine/cli/blob/${{ steps.version.outputs.version }}/CHANGELOG.md) for details.
+
+ ### Requirements
+
+ - PHP >= 8.1
+ files: |
+ build/div.phar
+ build/div-cli-${{ steps.version.outputs.version }}.pdf
+ draft: false
+ prerelease: false
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
new file mode 100644
index 0000000..6b566bd
--- /dev/null
+++ b/.github/workflows/tests.yml
@@ -0,0 +1,32 @@
+name: Tests
+
+on:
+ pull_request:
+ branches: [ main ]
+ workflow_dispatch:
+
+concurrency:
+ group: tests-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ phpunit:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Setup PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: "8.3"
+ coverage: none
+
+ - name: Validate composer.json
+ run: composer validate --no-interaction
+
+ - name: Install dependencies
+ run: composer install --no-interaction --prefer-dist --no-progress
+
+ - name: Run tests
+ run: vendor/bin/phpunit --colors=never
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..7083002
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,231 @@
+GNU GENERAL PUBLIC LICENSE
+Version 3, 29 June 2007
+Copyright © 2007 Free Software Foundation, Inc.
+
+Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
+
+Preamble
+
+The GNU General Public License is a free, copyleft license for software and other kinds of works.
+
+The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
+
+When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
+
+To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
+
+For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
+
+Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
+
+For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
+
+Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
+
+Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
+
+The precise terms and conditions for copying, distribution and modification follow.
+
+TERMS AND CONDITIONS
+
+0. Definitions.
+
+“This License” refers to version 3 of the GNU General Public License.
+
+“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
+
+“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
+
+To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
+
+A “covered work” means either the unmodified Program or a work based on the Program.
+
+To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
+
+To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
+
+An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
+
+1. Source Code.
+The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
+
+A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
+
+The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
+
+The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
+
+The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
+
+The Corresponding Source for a work in source code form is that same work.
+
+2. Basic Permissions.
+All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
+
+You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
+
+Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
+
+3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
+
+When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
+
+4. Conveying Verbatim Copies.
+You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
+
+You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
+
+5. Conveying Modified Source Versions.
+You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
+
+a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
+
+b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
+
+c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
+
+d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
+
+A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
+
+6. Conveying Non-Source Forms.
+You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
+
+a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
+
+b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
+
+c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
+
+d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
+
+e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
+
+A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
+
+A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
+
+“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
+
+If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
+
+The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
+
+Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
+
+7. Additional Terms.
+“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
+
+When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
+
+Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
+
+a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
+
+b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
+
+c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
+
+d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
+
+e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
+
+f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
+
+All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
+
+If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
+
+Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
+
+8. Termination.
+You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
+
+However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
+
+Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
+
+Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
+
+9. Acceptance Not Required for Having Copies.
+You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
+
+10. Automatic Licensing of Downstream Recipients.
+Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
+
+An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
+
+You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
+
+11. Patents.
+A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.
+
+A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
+
+Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
+
+In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
+
+If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
+
+If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
+
+A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
+
+Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
+
+12. No Surrender of Others' Freedom.
+If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
+
+13. Use with the GNU Affero General Public License.
+Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
+
+14. Revised Versions of this License.
+The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
+
+If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
+
+Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
+
+15. Disclaimer of Warranty.
+THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+16. Limitation of Liability.
+IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+17. Interpretation of Sections 15 and 16.
+If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
+
+END OF TERMS AND CONDITIONS
+
+How to Apply These Terms to Your New Programs
+
+If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
+
+To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
+
+
+Copyright (C)
+
+This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.
+
+You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see .
+
+The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read .
diff --git a/README.md b/README.md
index e510a66..01d791b 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,280 @@
-# cli
\ No newline at end of file
+# Divengine CLI
+
+> Runtime CLI for the Divengine template ecosystem
+
+## Philosophy
+
+`div` is a focused CLI tool centered on **template generation and transformation**. It is not a general-purpose utility belt.
+
+**Focus areas:**
+- Rendering and transforming templates
+- Building artifacts from templates
+- Resolving templates from packages
+- Managing the Divengine template ecosystem
+
+**What div is NOT:**
+- Not a replacement for `grep`, `sed`, `awk`, or other Unix text tools
+- Not a general-purpose script runner
+- Not a build system for arbitrary tasks
+
+## Requirements
+
+- PHP >= 8.1
+
+## Installation
+
+### Quick Install (Recommended)
+
+**Linux / macOS:**
+```bash
+curl -sSL https://raw.githubusercontent.com/divengine/cli/main/install | php
+```
+
+**Windows (PowerShell):**
+```powershell
+irm https://raw.githubusercontent.com/divengine/cli/main/install.ps1 | iex
+```
+
+**Windows (CMD):**
+```cmd
+curl -sL https://raw.githubusercontent.com/divengine/cli/main/install.bat -o install.bat && install.bat
+```
+
+After installation, restart your terminal and run `div --help`.
+
+### Custom Install Directory
+
+```bash
+# Install to custom directory
+curl -sSL https://raw.githubusercontent.com/divengine/cli/main/install | php -s --install-dir=/opt/bin
+```
+
+### Development Install (Local)
+
+If you're developing div CLI, install from local source:
+
+```bash
+# Clone and install from local build
+git clone https://github.com/divengine/cli.git
+cd cli
+php install --from-here
+
+# This will:
+# 1. Build the PHAR from source (if not exists)
+# 2. Install it to /usr/local/bin
+```
+
+For manual development:
+```bash
+composer install
+php bin/div --help
+```
+
+## Requirements
+
+- PHP >= 8.1
+
+## Commands
+
+### `div help [command]`
+Show help for all commands or a specific command.
+
+```bash
+div help # List all commands
+div help render # Show render command help
+```
+
+### `div version`
+Show CLI version.
+
+```bash
+div version
+# Output: Divengine CLI v1.0.0
+```
+
+### `div render [--input=file] [--output=file]`
+Render a template with input data. Input format auto-detected (JSON, YAML, XML, PHP).
+
+```bash
+# Pipe JSON from stdin
+echo '{"name": "World"}' | div render template.tpl
+
+# Pipe YAML from stdin
+cat config.yaml | div render template.tpl
+
+# Pipe XML from stdin
+echo '' | div render template.tpl
+
+# Input file (overrides stdin if both present)
+div render template.tpl --input=data.json
+
+# Force format
+div render template.tpl --input=data.txt --format=yaml
+
+# Save output to file
+div render template.tpl --input=data.json --output=result.txt
+```
+
+### `div build [--input=file] [--out-dir=dir] [--dry-run]`
+Build artifacts from templates.
+
+```bash
+# Pipe input from stdin
+cat data.json | div build template.tpl --out-dir=dist
+
+# Dry run (show what would be built)
+div build template.tpl --input=data.json --dry-run
+```
+
+### `div templates [path]`
+List available templates.
+
+```bash
+# Search default locations
+div templates
+
+# Search specific path
+div templates ./my-templates
+```
+
+### `div packages [vendor-path]`
+List packages in vendor directory.
+
+```bash
+div packages
+```
+
+## Template Format
+
+Templates use `{$variable}` syntax for variable substitution (Divengine syntax):
+
+```tpl
+Hello, {$name}!
+Your order #{$order_id} is ready.
+```
+
+With input JSON:
+```json
+{
+ "name": "Alice",
+ "order_id": "12345"
+}
+```
+
+## Examples
+
+### Basic Template Rendering
+
+```bash
+# Create a template
+echo "Hello, {$name}!" > greet.tpl
+
+# Create data file
+echo '{"name": "World"}' > data.json
+
+# Render
+div render greet.tpl --input=data.json
+# Output: Hello, World!
+```
+
+### Build Workflow
+
+```bash
+# Dry run first
+div build template.tpl --input=data.json --dry-run
+
+# Build to output directory
+div build template.tpl --input=data.json --out-dir=dist
+```
+
+## Architecture
+
+```
+src/
+├── cli/
+│ ├── Application.php # Command registry and routing
+│ └── Command.php # Abstract base command
+├── commands/
+│ ├── HelpCommand.php
+│ ├── VersionCommand.php
+│ ├── DoctorCommand.php
+│ ├── RenderCommand.php
+│ ├── TransformCommand.php
+│ ├── BuildCommand.php
+│ ├── TemplatesCommand.php
+│ ├── PackagesCommand.php
+│ └── ResolveCommand.php
+├── core/
+│ ├── ArgParser.php # CLI argument parsing
+│ ├── TemplateRunner.php # Template execution engine
+│ ├── Filesystem.php # File utilities
+│ ├── PackageInspector.php # Package discovery
+│ └── DoctorService.php # Environment diagnostics
+└── utils/
+ └── Console.php # Console output helpers
+```
+
+## Extending
+
+Create a new command:
+
+```php
+';
+ protected string $help = 'Help text here.';
+
+ public function run(array $args): int
+ {
+ Console::info('Running my command');
+ return 0;
+ }
+}
+```
+
+Register in `Application::registerDefaultCommands()`:
+
+```php
+$this->register(new \divengine\commands\MyCommand());
+```
+
+## Future Capabilities (Planned)
+
+- [x] Basic template rendering (fallback engine)
+- [x] Full divengine/div integration
+- [ ] Package-based template resolution (`org/package/template`)
+- [ ] Multi-file template generation
+- [ ] Template caching system
+- [ ] Plugin system
+- [ ] Interactive mode for AI agents
+
+## Current Limitations
+
+- Template resolution is file-system only (no package resolution yet)
+- Build command is single-file for now (multi-file planned)
+- No template caching
+- No plugin system
+
+## Console Output
+
+The CLI uses standard ANSI escape codes for colored terminal output. This provides:
+- Consistent, readable output across platforms
+- Semantic coloring: errors (red), warnings (yellow), success (green), info (cyan)
+- Multi-segment lines with different colors in the same output
+- Basic progress indicators
+
+Color support is automatically detected and gracefully degraded when not available.
+
+## License
+
+MIT
diff --git a/bin/div b/bin/div
new file mode 100644
index 0000000..9803325
--- /dev/null
+++ b/bin/div
@@ -0,0 +1,53 @@
+#!/usr/bin/env php
+run($argv));
diff --git a/bin/div.bat b/bin/div.bat
new file mode 100644
index 0000000..cd43a49
--- /dev/null
+++ b/bin/div.bat
@@ -0,0 +1,2 @@
+@echo off
+php "%~dp0div" %*
diff --git a/build/build-phar.bat b/build/build-phar.bat
new file mode 100644
index 0000000..5d3d272
--- /dev/null
+++ b/build/build-phar.bat
@@ -0,0 +1,40 @@
+@echo off
+REM
+REM Build script for div.phar on Windows
+REM
+REM Usage:
+REM build\build-phar.bat
+REM
+
+setlocal EnableDelayedExpansion
+
+echo.
+echo ========================================
+echo div CLI - Building PHAR
+echo ========================================
+echo.
+
+cd /d "%~dp0.."
+
+if not exist "composer.json" (
+ echo ERROR: composer.json not found. Run this from the project root.
+ exit /b 1
+)
+
+if not exist "vendor" (
+ echo Installing dependencies...
+ call composer install --no-interaction
+)
+
+echo.
+echo Building PHAR...
+echo.
+
+php -d phar.readonly=0 "%~dp0build-phar.php"
+
+if exist "%~dp0div.phar" (
+ echo.
+ echo Done!
+)
+
+endlocal
diff --git a/build/build-phar.php b/build/build-phar.php
new file mode 100644
index 0000000..a4eec91
--- /dev/null
+++ b/build/build-phar.php
@@ -0,0 +1,191 @@
+#!/usr/bin/env php
+startBuffering();
+
+ $phar->addFile($srcDir . '/vendor/autoload.php', 'vendor/autoload.php');
+
+ $vendorDir = $srcDir . '/vendor';
+ if (is_dir($vendorDir)) {
+ echo "Adding vendor files (excluding dev dependencies)...\n";
+
+ $skipDirs = ['phpunit', 'phpdocumentor', 'phpspec', 'sebastian', 'theseer', 'myclabs', 'phar-io', 'nikic'];
+
+ $vendorFiles = new RecursiveIteratorIterator(
+ new RecursiveDirectoryIterator($vendorDir, RecursiveDirectoryIterator::SKIP_DOTS),
+ RecursiveIteratorIterator::SELF_FIRST
+ );
+
+ $vendorCount = 0;
+ $skipped = 0;
+ $lastDot = 0;
+
+ foreach ($vendorFiles as $file) {
+ if ($file->isDir()) {
+ continue;
+ }
+
+ $relativePath = substr($file->getPathname(), strlen($vendorDir) + 1);
+ $parts = explode(DIRECTORY_SEPARATOR, $relativePath);
+ $firstDir = $parts[0] ?? '';
+
+ if (in_array($firstDir, $skipDirs)) {
+ $skipped++;
+ continue;
+ }
+
+ $phar->addFile($file->getPathname(), 'vendor/' . $relativePath);
+ $vendorCount++;
+
+ if ($vendorCount - $lastDot >= 100) {
+ echo ".";
+ $lastDot = $vendorCount;
+ }
+ }
+
+ echo " ({$vendorCount} files, {$skipped} skipped)\n";
+ } else {
+ echo "Note: vendor directory not found, skipping.\n";
+ }
+
+ $srcFiles = new RecursiveIteratorIterator(
+ new RecursiveDirectoryIterator($srcDir . '/src', RecursiveDirectoryIterator::SKIP_DOTS),
+ RecursiveIteratorIterator::SELF_FIRST
+ );
+
+ $srcCount = 0;
+ foreach ($srcFiles as $file) {
+ if ($file->isFile()) {
+ $relativePath = substr($file->getPathname(), strlen($srcDir) + 1);
+ $phar->addFile($file->getPathname(), $relativePath);
+ $srcCount++;
+ }
+ }
+ echo "Adding source files... ({$srcCount} files)\n";
+
+ $pharAutoload = <<<'AUTOLOAD'
+ 'src/cli/',
+ 'divengine\\commands\\' => 'src/commands/',
+ 'divengine\\core\\' => 'src/core/',
+ 'divengine\\utils\\' => 'src/utils/',
+ 'divengine\\' => 'vendor/divengine/',
+ ];
+
+ foreach ($dirs as $prefix => $path) {
+ $len = strlen($prefix);
+ if (strncmp($prefix, $class, $len) !== 0) {
+ continue;
+ }
+
+ $relativeClass = substr($class, $len);
+ $file = PHAR_ROOT . '/' . $path . str_replace('\\', '/', $relativeClass) . '.php';
+
+ if (file_exists($file)) {
+ require $file;
+ return true;
+ }
+ }
+
+ return false;
+});
+
+require PHAR_ROOT . '/vendor/divengine/functions/src/functions.php';
+require PHAR_ROOT . '/vendor/divengine/div/src/div.php';
+AUTOLOAD;
+
+ $phar->addFromString('vendor/autoload.php', $pharAutoload);
+
+ $stub = <<<'STUB'
+#!/usr/bin/env php
+run($argv));
+__HALT_COMPILER();
+STUB;
+
+ $phar->addFromString('vendor/autoload.php', $pharAutoload);
+
+ $phar->setStub($stub);
+ $phar->stopBuffering();
+
+ $size = filesize($pharPath);
+ $sizeFormatted = number_format($size / 1024 / 1024, 2) . ' MB';
+
+ echo "\n";
+ echo "========================================\n";
+ echo " Build Complete!\n";
+ echo "========================================\n";
+ echo "\n";
+ echo " Output: {$pharPath}\n";
+ echo " Size: {$sizeFormatted}\n";
+ echo "\n";
+ echo " Usage:\n";
+ echo " php {$pharPath} --help\n";
+ echo "\n";
+
+} catch (Exception $e) {
+ echo "\nERROR: " . $e->getMessage() . "\n";
+ exit(1);
+}
diff --git a/build/build-phar.ps1 b/build/build-phar.ps1
new file mode 100644
index 0000000..ac62aac
--- /dev/null
+++ b/build/build-phar.ps1
@@ -0,0 +1,38 @@
+# Build script for div.phar on Windows (PowerShell)
+#
+# Usage:
+# .\build\build-phar.ps1
+
+$ErrorActionPreference = "Stop"
+
+$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
+$ProjectRoot = Split-Path -Parent $ScriptDir
+
+Write-Host ""
+Write-Host "========================================" -ForegroundColor Cyan
+Write-Host " div CLI - Building PHAR" -ForegroundColor Cyan
+Write-Host "========================================" -ForegroundColor Cyan
+Write-Host ""
+
+Set-Location $ProjectRoot
+
+if (-not (Test-Path "composer.json")) {
+ Write-Host "ERROR: composer.json not found. Run this from the project root." -ForegroundColor Red
+ exit 1
+}
+
+if (-not (Test-Path "vendor")) {
+ Write-Host "Installing dependencies..."
+ composer install --no-interaction
+}
+
+Write-Host ""
+Write-Host "Building PHAR..."
+Write-Host ""
+
+php -d phar.readonly=0 "$ScriptDir\build-phar.php"
+
+if (Test-Path "$ScriptDir\div.phar") {
+ Write-Host ""
+ Write-Host "Done!" -ForegroundColor Green
+}
diff --git a/build/build-phar.sh b/build/build-phar.sh
new file mode 100644
index 0000000..7dd90f9
--- /dev/null
+++ b/build/build-phar.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+#
+# Build script for div.phar on Linux/macOS
+#
+# Usage:
+# ./build/build-phar.sh
+#
+
+set -e
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
+
+echo ""
+echo "========================================"
+echo " div CLI - Building PHAR"
+echo "========================================"
+echo ""
+
+cd "$PROJECT_ROOT"
+
+if [ ! -f "composer.json" ]; then
+ echo "ERROR: composer.json not found. Run this from the project root."
+ exit 1
+fi
+
+if [ ! -d "vendor" ]; then
+ echo "Installing dependencies..."
+ composer install --no-interaction
+fi
+
+echo ""
+echo "Building PHAR..."
+echo ""
+
+php -d phar.readonly=0 "$SCRIPT_DIR/build-phar.php"
+
+if [ -f "$SCRIPT_DIR/div.phar" ]; then
+ chmod +x "$SCRIPT_DIR/div.phar"
+ echo ""
+ echo "Making executable..."
+ echo ""
+fi
+
+echo "Done!"
diff --git a/build/test-phar.bat b/build/test-phar.bat
new file mode 100644
index 0000000..12a6be9
--- /dev/null
+++ b/build/test-phar.bat
@@ -0,0 +1,36 @@
+@echo off
+REM
+REM Test script for div.phar on Windows
+REM
+REM Usage:
+REM build\test-phar.bat [command]
+REM
+
+setlocal
+
+set "SCRIPT_DIR=%~dp0"
+set "PHAR_PATH=%SCRIPT_DIR%div.phar"
+
+echo.
+echo Testing div.phar...
+echo.
+
+if not exist "%PHAR_PATH%" (
+ echo ERROR: div.phar not found at: %PHAR_PATH%
+ echo.
+ echo Run build\build-phar.bat first to build it.
+ exit /b 1
+)
+
+set "COMMAND=%1"
+if "%COMMAND%"=="" set "COMMAND=version"
+
+echo Running: div.phar %COMMAND%
+echo.
+
+php "%PHAR_PATH%" %COMMAND%
+
+echo.
+echo Test complete!
+
+endlocal
diff --git a/build/test-phar.ps1 b/build/test-phar.ps1
new file mode 100644
index 0000000..5b37fe1
--- /dev/null
+++ b/build/test-phar.ps1
@@ -0,0 +1,28 @@
+# Test script for div.phar on Windows (PowerShell)
+#
+# Usage:
+# .\build\test-phar.ps1 [command]
+
+$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
+$PharPath = Join-Path $ScriptDir "div.phar"
+
+Write-Host ""
+Write-Host "Testing div.phar..." -ForegroundColor Cyan
+Write-Host ""
+
+if (-not (Test-Path $PharPath)) {
+ Write-Host "ERROR: div.phar not found at: $PharPath" -ForegroundColor Red
+ Write-Host ""
+ Write-Host "Run .\build\build-phar.ps1 first to build it." -ForegroundColor Yellow
+ exit 1
+}
+
+$Command = if ($Args.Count -gt 0) { $Args[0] } else { "version" }
+
+Write-Host "Running: div.phar $Command"
+Write-Host ""
+
+php $PharPath $Command
+
+Write-Host ""
+Write-Host "Test complete!" -ForegroundColor Green
diff --git a/build/test-phar.sh b/build/test-phar.sh
new file mode 100644
index 0000000..e6dda40
--- /dev/null
+++ b/build/test-phar.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+#
+# Test script for div.phar
+#
+# Usage:
+# ./build/test-phar.sh [command]
+#
+
+set -e
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+PHAR_PATH="$SCRIPT_DIR/div.phar"
+
+echo ""
+echo "Testing div.phar..."
+echo ""
+
+if [ ! -f "$PHAR_PATH" ]; then
+ echo "ERROR: div.phar not found at: $PHAR_PATH"
+ echo ""
+ echo "Run ./build/build-phar.sh first to build it."
+ exit 1
+fi
+
+COMMAND="${1:-version}"
+
+echo "Running: div.phar $COMMAND"
+echo ""
+
+php "$PHAR_PATH" $COMMAND
+
+echo ""
+echo "Test complete!"
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..9a0c46f
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,26 @@
+{
+ "name": "divengine/cli",
+ "description": "Div CLI - Official runtime and package manager for the Divengine ecosystem",
+ "type": "library",
+ "license": "MIT",
+ "require": {
+ "php": ">=8.1",
+ "divengine/div": "^6.0"
+ },
+ "autoload": {
+ "psr-4": {
+ "divengine\\": "src/"
+ }
+ },
+ "bin": [
+ "bin/div"
+ ],
+ "require-dev": {
+ "phpunit/phpunit": "^10.0",
+ "phpstan/phpstan": "^1.10"
+ },
+ "scripts": {
+ "test": "phpunit",
+ "build:phar": "php build/build-phar.php"
+ }
+}
diff --git a/composer.lock b/composer.lock
new file mode 100644
index 0000000..fb7ba5c
--- /dev/null
+++ b/composer.lock
@@ -0,0 +1,1853 @@
+{
+ "_readme": [
+ "This file locks the dependencies of your project to a known state",
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
+ "This file is @generated automatically"
+ ],
+ "content-hash": "e54352ca781393607c35a8941464a3f5",
+ "packages": [
+ {
+ "name": "divengine/div",
+ "version": "6.1.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/divengine/div.git",
+ "reference": "e43ad3c8d2015f19b45d0a40a3347468b0996366"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/divengine/div/zipball/e43ad3c8d2015f19b45d0a40a3347468b0996366",
+ "reference": "e43ad3c8d2015f19b45d0a40a3347468b0996366",
+ "shasum": ""
+ },
+ "require": {
+ "divengine/functions": "^1.0",
+ "php": ">=8.0.0"
+ },
+ "require-dev": {
+ "phpstan/phpstan": "^1.10",
+ "phpunit/phpunit": "^10.5"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "divengine\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "GPL-3.0-or-later"
+ ],
+ "authors": [
+ {
+ "name": "Rafa Rodriguez",
+ "email": "rafageist@divengine.com",
+ "homepage": "https://rafageist.com",
+ "role": "Founder"
+ }
+ ],
+ "description": "Div PHP Template Engine",
+ "homepage": "https://divengine.com",
+ "keywords": [
+ "code generator",
+ "template engine"
+ ],
+ "support": {
+ "issues": "https://github.com/divengine/div/issues",
+ "source": "https://github.com/divengine/div/tree/v6.1.3"
+ },
+ "time": "2026-02-08T17:24:26+00:00"
+ },
+ {
+ "name": "divengine/functions",
+ "version": "1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/divengine/functions.git",
+ "reference": "494165fbac064eb958324519b8c82bc237818269"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/divengine/functions/zipball/494165fbac064eb958324519b8c82bc237818269",
+ "reference": "494165fbac064eb958324519b8c82bc237818269",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.0.0"
+ },
+ "require-dev": {
+ "phpstan/phpstan": "^1.11",
+ "phpunit/phpunit": "^11.2"
+ },
+ "type": "library",
+ "autoload": {
+ "files": [
+ "src/functions.php"
+ ],
+ "psr-4": {
+ "divengine\\": "src/",
+ "divengine\\tests\\": "tests/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "GPL-3.0-or-later"
+ ],
+ "authors": [
+ {
+ "name": "Rafa Rodriguez",
+ "email": "rafageist@divengine.com",
+ "homepage": "https://rafageist.com",
+ "role": "Founder"
+ }
+ ],
+ "description": "Div PHP Functions",
+ "homepage": "https://divengine.org",
+ "keywords": [
+ "functions",
+ "helpers",
+ "php language",
+ "utilities"
+ ],
+ "support": {
+ "issues": "https://github.com/divengine/functions/issues",
+ "source": "https://github.com/divengine/functions/tree/v1.0.1"
+ },
+ "time": "2024-08-06T03:39:31+00:00"
+ }
+ ],
+ "packages-dev": [
+ {
+ "name": "myclabs/deep-copy",
+ "version": "1.13.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/myclabs/DeepCopy.git",
+ "reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/07d290f0c47959fd5eed98c95ee5602db07e0b6a",
+ "reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.1 || ^8.0"
+ },
+ "conflict": {
+ "doctrine/collections": "<1.6.8",
+ "doctrine/common": "<2.13.3 || >=3 <3.2.2"
+ },
+ "require-dev": {
+ "doctrine/collections": "^1.6.8",
+ "doctrine/common": "^2.13.3 || ^3.2.2",
+ "phpspec/prophecy": "^1.10",
+ "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13"
+ },
+ "type": "library",
+ "autoload": {
+ "files": [
+ "src/DeepCopy/deep_copy.php"
+ ],
+ "psr-4": {
+ "DeepCopy\\": "src/DeepCopy/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "description": "Create deep copies (clones) of your objects",
+ "keywords": [
+ "clone",
+ "copy",
+ "duplicate",
+ "object",
+ "object graph"
+ ],
+ "support": {
+ "issues": "https://github.com/myclabs/DeepCopy/issues",
+ "source": "https://github.com/myclabs/DeepCopy/tree/1.13.4"
+ },
+ "funding": [
+ {
+ "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2025-08-01T08:46:24+00:00"
+ },
+ {
+ "name": "nikic/php-parser",
+ "version": "v5.7.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/nikic/PHP-Parser.git",
+ "reference": "dca41cd15c2ac9d055ad70dbfd011130757d1f82"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/dca41cd15c2ac9d055ad70dbfd011130757d1f82",
+ "reference": "dca41cd15c2ac9d055ad70dbfd011130757d1f82",
+ "shasum": ""
+ },
+ "require": {
+ "ext-ctype": "*",
+ "ext-json": "*",
+ "ext-tokenizer": "*",
+ "php": ">=7.4"
+ },
+ "require-dev": {
+ "ircmaxell/php-yacc": "^0.0.7",
+ "phpunit/phpunit": "^9.0"
+ },
+ "bin": [
+ "bin/php-parse"
+ ],
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "5.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "PhpParser\\": "lib/PhpParser"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Nikita Popov"
+ }
+ ],
+ "description": "A PHP parser written in PHP",
+ "keywords": [
+ "parser",
+ "php"
+ ],
+ "support": {
+ "issues": "https://github.com/nikic/PHP-Parser/issues",
+ "source": "https://github.com/nikic/PHP-Parser/tree/v5.7.0"
+ },
+ "time": "2025-12-06T11:56:16+00:00"
+ },
+ {
+ "name": "phar-io/manifest",
+ "version": "2.0.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phar-io/manifest.git",
+ "reference": "54750ef60c58e43759730615a392c31c80e23176"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176",
+ "reference": "54750ef60c58e43759730615a392c31c80e23176",
+ "shasum": ""
+ },
+ "require": {
+ "ext-dom": "*",
+ "ext-libxml": "*",
+ "ext-phar": "*",
+ "ext-xmlwriter": "*",
+ "phar-io/version": "^3.0.1",
+ "php": "^7.2 || ^8.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Arne Blankerts",
+ "email": "arne@blankerts.de",
+ "role": "Developer"
+ },
+ {
+ "name": "Sebastian Heuer",
+ "email": "sebastian@phpeople.de",
+ "role": "Developer"
+ },
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "Developer"
+ }
+ ],
+ "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)",
+ "support": {
+ "issues": "https://github.com/phar-io/manifest/issues",
+ "source": "https://github.com/phar-io/manifest/tree/2.0.4"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/theseer",
+ "type": "github"
+ }
+ ],
+ "time": "2024-03-03T12:33:53+00:00"
+ },
+ {
+ "name": "phar-io/version",
+ "version": "3.2.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phar-io/version.git",
+ "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74",
+ "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.2 || ^8.0"
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Arne Blankerts",
+ "email": "arne@blankerts.de",
+ "role": "Developer"
+ },
+ {
+ "name": "Sebastian Heuer",
+ "email": "sebastian@phpeople.de",
+ "role": "Developer"
+ },
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "Developer"
+ }
+ ],
+ "description": "Library for handling version information and constraints",
+ "support": {
+ "issues": "https://github.com/phar-io/version/issues",
+ "source": "https://github.com/phar-io/version/tree/3.2.1"
+ },
+ "time": "2022-02-21T01:04:05+00:00"
+ },
+ {
+ "name": "phpstan/phpstan",
+ "version": "1.12.33",
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpstan/phpstan/zipball/37982d6fc7cbb746dda7773530cda557cdf119e1",
+ "reference": "37982d6fc7cbb746dda7773530cda557cdf119e1",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.2|^8.0"
+ },
+ "conflict": {
+ "phpstan/phpstan-shim": "*"
+ },
+ "bin": [
+ "phpstan",
+ "phpstan.phar"
+ ],
+ "type": "library",
+ "autoload": {
+ "files": [
+ "bootstrap.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "description": "PHPStan - PHP Static Analysis Tool",
+ "keywords": [
+ "dev",
+ "static analysis"
+ ],
+ "support": {
+ "docs": "https://phpstan.org/user-guide/getting-started",
+ "forum": "https://github.com/phpstan/phpstan/discussions",
+ "issues": "https://github.com/phpstan/phpstan/issues",
+ "security": "https://github.com/phpstan/phpstan/security/policy",
+ "source": "https://github.com/phpstan/phpstan-src"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/ondrejmirtes",
+ "type": "github"
+ },
+ {
+ "url": "https://github.com/phpstan",
+ "type": "github"
+ }
+ ],
+ "time": "2026-02-28T20:30:03+00:00"
+ },
+ {
+ "name": "phpunit/php-code-coverage",
+ "version": "10.1.16",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
+ "reference": "7e308268858ed6baedc8704a304727d20bc07c77"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/7e308268858ed6baedc8704a304727d20bc07c77",
+ "reference": "7e308268858ed6baedc8704a304727d20bc07c77",
+ "shasum": ""
+ },
+ "require": {
+ "ext-dom": "*",
+ "ext-libxml": "*",
+ "ext-xmlwriter": "*",
+ "nikic/php-parser": "^4.19.1 || ^5.1.0",
+ "php": ">=8.1",
+ "phpunit/php-file-iterator": "^4.1.0",
+ "phpunit/php-text-template": "^3.0.1",
+ "sebastian/code-unit-reverse-lookup": "^3.0.0",
+ "sebastian/complexity": "^3.2.0",
+ "sebastian/environment": "^6.1.0",
+ "sebastian/lines-of-code": "^2.0.2",
+ "sebastian/version": "^4.0.1",
+ "theseer/tokenizer": "^1.2.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^10.1"
+ },
+ "suggest": {
+ "ext-pcov": "PHP extension that provides line coverage",
+ "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "10.1.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
+ "homepage": "https://github.com/sebastianbergmann/php-code-coverage",
+ "keywords": [
+ "coverage",
+ "testing",
+ "xunit"
+ ],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
+ "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy",
+ "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.16"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2024-08-22T04:31:57+00:00"
+ },
+ {
+ "name": "phpunit/php-file-iterator",
+ "version": "4.1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-file-iterator.git",
+ "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a95037b6d9e608ba092da1b23931e537cadc3c3c",
+ "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^10.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "4.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "FilterIterator implementation that filters files based on a list of suffixes.",
+ "homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
+ "keywords": [
+ "filesystem",
+ "iterator"
+ ],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues",
+ "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy",
+ "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/4.1.0"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2023-08-31T06:24:48+00:00"
+ },
+ {
+ "name": "phpunit/php-invoker",
+ "version": "4.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-invoker.git",
+ "reference": "f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7",
+ "reference": "f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1"
+ },
+ "require-dev": {
+ "ext-pcntl": "*",
+ "phpunit/phpunit": "^10.0"
+ },
+ "suggest": {
+ "ext-pcntl": "*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "4.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Invoke callables with a timeout",
+ "homepage": "https://github.com/sebastianbergmann/php-invoker/",
+ "keywords": [
+ "process"
+ ],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/php-invoker/issues",
+ "source": "https://github.com/sebastianbergmann/php-invoker/tree/4.0.0"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2023-02-03T06:56:09+00:00"
+ },
+ {
+ "name": "phpunit/php-text-template",
+ "version": "3.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-text-template.git",
+ "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/0c7b06ff49e3d5072f057eb1fa59258bf287a748",
+ "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^10.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "3.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Simple template engine.",
+ "homepage": "https://github.com/sebastianbergmann/php-text-template/",
+ "keywords": [
+ "template"
+ ],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/php-text-template/issues",
+ "security": "https://github.com/sebastianbergmann/php-text-template/security/policy",
+ "source": "https://github.com/sebastianbergmann/php-text-template/tree/3.0.1"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2023-08-31T14:07:24+00:00"
+ },
+ {
+ "name": "phpunit/php-timer",
+ "version": "6.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-timer.git",
+ "reference": "e2a2d67966e740530f4a3343fe2e030ffdc1161d"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/e2a2d67966e740530f4a3343fe2e030ffdc1161d",
+ "reference": "e2a2d67966e740530f4a3343fe2e030ffdc1161d",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^10.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "6.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Utility class for timing",
+ "homepage": "https://github.com/sebastianbergmann/php-timer/",
+ "keywords": [
+ "timer"
+ ],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/php-timer/issues",
+ "source": "https://github.com/sebastianbergmann/php-timer/tree/6.0.0"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2023-02-03T06:57:52+00:00"
+ },
+ {
+ "name": "phpunit/phpunit",
+ "version": "10.5.63",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/phpunit.git",
+ "reference": "33198268dad71e926626b618f3ec3966661e4d90"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/33198268dad71e926626b618f3ec3966661e4d90",
+ "reference": "33198268dad71e926626b618f3ec3966661e4d90",
+ "shasum": ""
+ },
+ "require": {
+ "ext-dom": "*",
+ "ext-json": "*",
+ "ext-libxml": "*",
+ "ext-mbstring": "*",
+ "ext-xml": "*",
+ "ext-xmlwriter": "*",
+ "myclabs/deep-copy": "^1.13.4",
+ "phar-io/manifest": "^2.0.4",
+ "phar-io/version": "^3.2.1",
+ "php": ">=8.1",
+ "phpunit/php-code-coverage": "^10.1.16",
+ "phpunit/php-file-iterator": "^4.1.0",
+ "phpunit/php-invoker": "^4.0.0",
+ "phpunit/php-text-template": "^3.0.1",
+ "phpunit/php-timer": "^6.0.0",
+ "sebastian/cli-parser": "^2.0.1",
+ "sebastian/code-unit": "^2.0.0",
+ "sebastian/comparator": "^5.0.5",
+ "sebastian/diff": "^5.1.1",
+ "sebastian/environment": "^6.1.0",
+ "sebastian/exporter": "^5.1.4",
+ "sebastian/global-state": "^6.0.2",
+ "sebastian/object-enumerator": "^5.0.0",
+ "sebastian/recursion-context": "^5.0.1",
+ "sebastian/type": "^4.0.0",
+ "sebastian/version": "^4.0.1"
+ },
+ "suggest": {
+ "ext-soap": "To be able to generate mocks based on WSDL files"
+ },
+ "bin": [
+ "phpunit"
+ ],
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "10.5-dev"
+ }
+ },
+ "autoload": {
+ "files": [
+ "src/Framework/Assert/Functions.php"
+ ],
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "The PHP Unit Testing framework.",
+ "homepage": "https://phpunit.de/",
+ "keywords": [
+ "phpunit",
+ "testing",
+ "xunit"
+ ],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/phpunit/issues",
+ "security": "https://github.com/sebastianbergmann/phpunit/security/policy",
+ "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.63"
+ },
+ "funding": [
+ {
+ "url": "https://phpunit.de/sponsors.html",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ },
+ {
+ "url": "https://liberapay.com/sebastianbergmann",
+ "type": "liberapay"
+ },
+ {
+ "url": "https://thanks.dev/u/gh/sebastianbergmann",
+ "type": "thanks_dev"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2026-01-27T05:48:37+00:00"
+ },
+ {
+ "name": "sebastian/cli-parser",
+ "version": "2.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/cli-parser.git",
+ "reference": "c34583b87e7b7a8055bf6c450c2c77ce32a24084"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/c34583b87e7b7a8055bf6c450c2c77ce32a24084",
+ "reference": "c34583b87e7b7a8055bf6c450c2c77ce32a24084",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^10.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "2.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Library for parsing CLI options",
+ "homepage": "https://github.com/sebastianbergmann/cli-parser",
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/cli-parser/issues",
+ "security": "https://github.com/sebastianbergmann/cli-parser/security/policy",
+ "source": "https://github.com/sebastianbergmann/cli-parser/tree/2.0.1"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2024-03-02T07:12:49+00:00"
+ },
+ {
+ "name": "sebastian/code-unit",
+ "version": "2.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/code-unit.git",
+ "reference": "a81fee9eef0b7a76af11d121767abc44c104e503"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/a81fee9eef0b7a76af11d121767abc44c104e503",
+ "reference": "a81fee9eef0b7a76af11d121767abc44c104e503",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^10.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "2.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Collection of value objects that represent the PHP code units",
+ "homepage": "https://github.com/sebastianbergmann/code-unit",
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/code-unit/issues",
+ "source": "https://github.com/sebastianbergmann/code-unit/tree/2.0.0"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2023-02-03T06:58:43+00:00"
+ },
+ {
+ "name": "sebastian/code-unit-reverse-lookup",
+ "version": "3.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git",
+ "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/5e3a687f7d8ae33fb362c5c0743794bbb2420a1d",
+ "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^10.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "3.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Looks up which function or method a line of code belongs to",
+ "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/",
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues",
+ "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/3.0.0"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2023-02-03T06:59:15+00:00"
+ },
+ {
+ "name": "sebastian/comparator",
+ "version": "5.0.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/comparator.git",
+ "reference": "55dfef806eb7dfeb6e7a6935601fef866f8ca48d"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55dfef806eb7dfeb6e7a6935601fef866f8ca48d",
+ "reference": "55dfef806eb7dfeb6e7a6935601fef866f8ca48d",
+ "shasum": ""
+ },
+ "require": {
+ "ext-dom": "*",
+ "ext-mbstring": "*",
+ "php": ">=8.1",
+ "sebastian/diff": "^5.0",
+ "sebastian/exporter": "^5.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^10.5"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "5.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ },
+ {
+ "name": "Jeff Welch",
+ "email": "whatthejeff@gmail.com"
+ },
+ {
+ "name": "Volker Dusch",
+ "email": "github@wallbash.com"
+ },
+ {
+ "name": "Bernhard Schussek",
+ "email": "bschussek@2bepublished.at"
+ }
+ ],
+ "description": "Provides the functionality to compare PHP values for equality",
+ "homepage": "https://github.com/sebastianbergmann/comparator",
+ "keywords": [
+ "comparator",
+ "compare",
+ "equality"
+ ],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/comparator/issues",
+ "security": "https://github.com/sebastianbergmann/comparator/security/policy",
+ "source": "https://github.com/sebastianbergmann/comparator/tree/5.0.5"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ },
+ {
+ "url": "https://liberapay.com/sebastianbergmann",
+ "type": "liberapay"
+ },
+ {
+ "url": "https://thanks.dev/u/gh/sebastianbergmann",
+ "type": "thanks_dev"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/sebastian/comparator",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2026-01-24T09:25:16+00:00"
+ },
+ {
+ "name": "sebastian/complexity",
+ "version": "3.2.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/complexity.git",
+ "reference": "68ff824baeae169ec9f2137158ee529584553799"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/68ff824baeae169ec9f2137158ee529584553799",
+ "reference": "68ff824baeae169ec9f2137158ee529584553799",
+ "shasum": ""
+ },
+ "require": {
+ "nikic/php-parser": "^4.18 || ^5.0",
+ "php": ">=8.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^10.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "3.2-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Library for calculating the complexity of PHP code units",
+ "homepage": "https://github.com/sebastianbergmann/complexity",
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/complexity/issues",
+ "security": "https://github.com/sebastianbergmann/complexity/security/policy",
+ "source": "https://github.com/sebastianbergmann/complexity/tree/3.2.0"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2023-12-21T08:37:17+00:00"
+ },
+ {
+ "name": "sebastian/diff",
+ "version": "5.1.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/diff.git",
+ "reference": "c41e007b4b62af48218231d6c2275e4c9b975b2e"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/c41e007b4b62af48218231d6c2275e4c9b975b2e",
+ "reference": "c41e007b4b62af48218231d6c2275e4c9b975b2e",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^10.0",
+ "symfony/process": "^6.4"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "5.1-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ },
+ {
+ "name": "Kore Nordmann",
+ "email": "mail@kore-nordmann.de"
+ }
+ ],
+ "description": "Diff implementation",
+ "homepage": "https://github.com/sebastianbergmann/diff",
+ "keywords": [
+ "diff",
+ "udiff",
+ "unidiff",
+ "unified diff"
+ ],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/diff/issues",
+ "security": "https://github.com/sebastianbergmann/diff/security/policy",
+ "source": "https://github.com/sebastianbergmann/diff/tree/5.1.1"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2024-03-02T07:15:17+00:00"
+ },
+ {
+ "name": "sebastian/environment",
+ "version": "6.1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/environment.git",
+ "reference": "8074dbcd93529b357029f5cc5058fd3e43666984"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/8074dbcd93529b357029f5cc5058fd3e43666984",
+ "reference": "8074dbcd93529b357029f5cc5058fd3e43666984",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^10.0"
+ },
+ "suggest": {
+ "ext-posix": "*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "6.1-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Provides functionality to handle HHVM/PHP environments",
+ "homepage": "https://github.com/sebastianbergmann/environment",
+ "keywords": [
+ "Xdebug",
+ "environment",
+ "hhvm"
+ ],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/environment/issues",
+ "security": "https://github.com/sebastianbergmann/environment/security/policy",
+ "source": "https://github.com/sebastianbergmann/environment/tree/6.1.0"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2024-03-23T08:47:14+00:00"
+ },
+ {
+ "name": "sebastian/exporter",
+ "version": "5.1.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/exporter.git",
+ "reference": "0735b90f4da94969541dac1da743446e276defa6"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/0735b90f4da94969541dac1da743446e276defa6",
+ "reference": "0735b90f4da94969541dac1da743446e276defa6",
+ "shasum": ""
+ },
+ "require": {
+ "ext-mbstring": "*",
+ "php": ">=8.1",
+ "sebastian/recursion-context": "^5.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^10.5"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "5.1-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ },
+ {
+ "name": "Jeff Welch",
+ "email": "whatthejeff@gmail.com"
+ },
+ {
+ "name": "Volker Dusch",
+ "email": "github@wallbash.com"
+ },
+ {
+ "name": "Adam Harvey",
+ "email": "aharvey@php.net"
+ },
+ {
+ "name": "Bernhard Schussek",
+ "email": "bschussek@gmail.com"
+ }
+ ],
+ "description": "Provides the functionality to export PHP variables for visualization",
+ "homepage": "https://www.github.com/sebastianbergmann/exporter",
+ "keywords": [
+ "export",
+ "exporter"
+ ],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/exporter/issues",
+ "security": "https://github.com/sebastianbergmann/exporter/security/policy",
+ "source": "https://github.com/sebastianbergmann/exporter/tree/5.1.4"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ },
+ {
+ "url": "https://liberapay.com/sebastianbergmann",
+ "type": "liberapay"
+ },
+ {
+ "url": "https://thanks.dev/u/gh/sebastianbergmann",
+ "type": "thanks_dev"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/sebastian/exporter",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2025-09-24T06:09:11+00:00"
+ },
+ {
+ "name": "sebastian/global-state",
+ "version": "6.0.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/global-state.git",
+ "reference": "987bafff24ecc4c9ac418cab1145b96dd6e9cbd9"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/987bafff24ecc4c9ac418cab1145b96dd6e9cbd9",
+ "reference": "987bafff24ecc4c9ac418cab1145b96dd6e9cbd9",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1",
+ "sebastian/object-reflector": "^3.0",
+ "sebastian/recursion-context": "^5.0"
+ },
+ "require-dev": {
+ "ext-dom": "*",
+ "phpunit/phpunit": "^10.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "6.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Snapshotting of global state",
+ "homepage": "https://www.github.com/sebastianbergmann/global-state",
+ "keywords": [
+ "global state"
+ ],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/global-state/issues",
+ "security": "https://github.com/sebastianbergmann/global-state/security/policy",
+ "source": "https://github.com/sebastianbergmann/global-state/tree/6.0.2"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2024-03-02T07:19:19+00:00"
+ },
+ {
+ "name": "sebastian/lines-of-code",
+ "version": "2.0.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/lines-of-code.git",
+ "reference": "856e7f6a75a84e339195d48c556f23be2ebf75d0"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/856e7f6a75a84e339195d48c556f23be2ebf75d0",
+ "reference": "856e7f6a75a84e339195d48c556f23be2ebf75d0",
+ "shasum": ""
+ },
+ "require": {
+ "nikic/php-parser": "^4.18 || ^5.0",
+ "php": ">=8.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^10.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "2.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Library for counting the lines of code in PHP source code",
+ "homepage": "https://github.com/sebastianbergmann/lines-of-code",
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/lines-of-code/issues",
+ "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy",
+ "source": "https://github.com/sebastianbergmann/lines-of-code/tree/2.0.2"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2023-12-21T08:38:20+00:00"
+ },
+ {
+ "name": "sebastian/object-enumerator",
+ "version": "5.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/object-enumerator.git",
+ "reference": "202d0e344a580d7f7d04b3fafce6933e59dae906"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/202d0e344a580d7f7d04b3fafce6933e59dae906",
+ "reference": "202d0e344a580d7f7d04b3fafce6933e59dae906",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1",
+ "sebastian/object-reflector": "^3.0",
+ "sebastian/recursion-context": "^5.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^10.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "5.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Traverses array structures and object graphs to enumerate all referenced objects",
+ "homepage": "https://github.com/sebastianbergmann/object-enumerator/",
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/object-enumerator/issues",
+ "source": "https://github.com/sebastianbergmann/object-enumerator/tree/5.0.0"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2023-02-03T07:08:32+00:00"
+ },
+ {
+ "name": "sebastian/object-reflector",
+ "version": "3.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/object-reflector.git",
+ "reference": "24ed13d98130f0e7122df55d06c5c4942a577957"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/24ed13d98130f0e7122df55d06c5c4942a577957",
+ "reference": "24ed13d98130f0e7122df55d06c5c4942a577957",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^10.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "3.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Allows reflection of object attributes, including inherited and non-public ones",
+ "homepage": "https://github.com/sebastianbergmann/object-reflector/",
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/object-reflector/issues",
+ "source": "https://github.com/sebastianbergmann/object-reflector/tree/3.0.0"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2023-02-03T07:06:18+00:00"
+ },
+ {
+ "name": "sebastian/recursion-context",
+ "version": "5.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/recursion-context.git",
+ "reference": "47e34210757a2f37a97dcd207d032e1b01e64c7a"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/47e34210757a2f37a97dcd207d032e1b01e64c7a",
+ "reference": "47e34210757a2f37a97dcd207d032e1b01e64c7a",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^10.5"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "5.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ },
+ {
+ "name": "Jeff Welch",
+ "email": "whatthejeff@gmail.com"
+ },
+ {
+ "name": "Adam Harvey",
+ "email": "aharvey@php.net"
+ }
+ ],
+ "description": "Provides functionality to recursively process PHP variables",
+ "homepage": "https://github.com/sebastianbergmann/recursion-context",
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/recursion-context/issues",
+ "security": "https://github.com/sebastianbergmann/recursion-context/security/policy",
+ "source": "https://github.com/sebastianbergmann/recursion-context/tree/5.0.1"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ },
+ {
+ "url": "https://liberapay.com/sebastianbergmann",
+ "type": "liberapay"
+ },
+ {
+ "url": "https://thanks.dev/u/gh/sebastianbergmann",
+ "type": "thanks_dev"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/sebastian/recursion-context",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2025-08-10T07:50:56+00:00"
+ },
+ {
+ "name": "sebastian/type",
+ "version": "4.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/type.git",
+ "reference": "462699a16464c3944eefc02ebdd77882bd3925bf"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/462699a16464c3944eefc02ebdd77882bd3925bf",
+ "reference": "462699a16464c3944eefc02ebdd77882bd3925bf",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^10.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "4.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Collection of value objects that represent the types of the PHP type system",
+ "homepage": "https://github.com/sebastianbergmann/type",
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/type/issues",
+ "source": "https://github.com/sebastianbergmann/type/tree/4.0.0"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2023-02-03T07:10:45+00:00"
+ },
+ {
+ "name": "sebastian/version",
+ "version": "4.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/version.git",
+ "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c51fa83a5d8f43f1402e3f32a005e6262244ef17",
+ "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "4.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Library that helps with managing the version number of Git-hosted PHP projects",
+ "homepage": "https://github.com/sebastianbergmann/version",
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/version/issues",
+ "source": "https://github.com/sebastianbergmann/version/tree/4.0.1"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2023-02-07T11:34:05+00:00"
+ },
+ {
+ "name": "theseer/tokenizer",
+ "version": "1.3.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/theseer/tokenizer.git",
+ "reference": "b7489ce515e168639d17feec34b8847c326b0b3c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b7489ce515e168639d17feec34b8847c326b0b3c",
+ "reference": "b7489ce515e168639d17feec34b8847c326b0b3c",
+ "shasum": ""
+ },
+ "require": {
+ "ext-dom": "*",
+ "ext-tokenizer": "*",
+ "ext-xmlwriter": "*",
+ "php": "^7.2 || ^8.0"
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Arne Blankerts",
+ "email": "arne@blankerts.de",
+ "role": "Developer"
+ }
+ ],
+ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats",
+ "support": {
+ "issues": "https://github.com/theseer/tokenizer/issues",
+ "source": "https://github.com/theseer/tokenizer/tree/1.3.1"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/theseer",
+ "type": "github"
+ }
+ ],
+ "time": "2025-11-17T20:03:58+00:00"
+ }
+ ],
+ "aliases": [],
+ "minimum-stability": "stable",
+ "stability-flags": [],
+ "prefer-stable": false,
+ "prefer-lowest": false,
+ "platform": {
+ "php": ">=8.1"
+ },
+ "platform-dev": [],
+ "plugin-api-version": "2.6.0"
+}
diff --git a/docs/01.Installation.md b/docs/01.Installation.md
new file mode 100644
index 0000000..384b7dc
--- /dev/null
+++ b/docs/01.Installation.md
@@ -0,0 +1,62 @@
+# Installation
+
+## Requirements
+
+- PHP >= 8.1
+
+## Quick Install
+
+### Unix / macOS
+
+```bash
+curl -sSL https://raw.githubusercontent.com/divengine/cli/main/install | php
+```
+
+### Windows (PowerShell)
+
+```powershell
+irm https://raw.githubusercontent.com/divengine/cli/main/install.ps1 | iex
+```
+
+### Windows (CMD)
+
+```cmd
+curl -sL https://raw.githubusercontent.com/divengine/cli/main/install.bat -o install.bat && install.bat
+```
+
+## Custom Install Directory
+
+```bash
+curl -sSL https://raw.githubusercontent.com/divengine/cli/main/install | php -s --install-dir=/opt/bin
+```
+
+## Local Install (from source)
+
+```bash
+git clone https://github.com/divengine/cli.git
+cd cli
+composer install
+./bin/div --help
+```
+
+## Verification
+
+After installation, verify it works:
+
+```bash
+div --help
+div version
+div doctor
+```
+
+## Uninstall
+
+Simply delete the installed file:
+
+```bash
+# Unix
+rm /usr/local/bin/div
+
+# Windows
+del %USERPROFILE%\bin\div.phar
+```
diff --git a/docs/02.Commands.md b/docs/02.Commands.md
new file mode 100644
index 0000000..87716c0
--- /dev/null
+++ b/docs/02.Commands.md
@@ -0,0 +1,102 @@
+# Commands
+
+## render
+
+Render a template with input data.
+
+```bash
+div render [--input=file] [--output=file] [--format=FMT]
+```
+
+### Options
+
+- `--input=FILE` - Input file (JSON, YAML, XML, PHP). Reads from stdin if omitted.
+- `--format=FMT` - Force input format (json, yaml, xml, php)
+- `--output=FILE` - Output file (default: stdout)
+
+### Examples
+
+```bash
+# With input file
+div render template.tpl --input=data.json
+
+# Pipe JSON from stdin
+echo '{"name": "World"}' | div render template.tpl
+
+# Save output
+div render template.tpl --input=data.json --output=result.txt
+```
+
+## build
+
+Build artifacts from templates.
+
+```bash
+div build [--input=file] [--out-dir=DIR] [--dry-run]
+```
+
+### Options
+
+- `--input=FILE` - Input file
+- `--out-dir=DIR` - Output directory
+- `--dry-run` - Preview without writing
+
+### Examples
+
+```bash
+# Preview build
+div build template.tpl --input=data.json --dry-run
+
+# Build to directory
+div build template.tpl --input=data.json --out-dir=dist
+```
+
+## version
+
+Show CLI version.
+
+```bash
+div version
+```
+
+## doctor
+
+Run environment diagnostics.
+
+```bash
+div doctor
+```
+
+Checks:
+- PHP version
+- Required extensions
+- Write permissions
+- Template paths
+
+## help
+
+Show help for commands.
+
+```bash
+div help # List all commands
+div help render # Help for specific command
+div render --help # Alternative syntax
+```
+
+## templates
+
+List available templates (.tpl and .div files).
+
+```bash
+div templates [path]
+```
+
+## packages
+
+List packages in vendor directory.
+
+```bash
+div packages [vendor-path]
+```
+
+
diff --git a/docs/03.Input-Formats.md b/docs/03.Input-Formats.md
new file mode 100644
index 0000000..846f71c
--- /dev/null
+++ b/docs/03.Input-Formats.md
@@ -0,0 +1,102 @@
+# Input Formats
+
+Div CLI supports multiple input formats for providing data to templates.
+
+## JSON
+
+Standard JSON objects and arrays.
+
+```json
+{
+ "name": "John",
+ "items": ["a", "b", "c"]
+}
+```
+
+```bash
+echo '{"name": "John"}' | div render template.tpl
+```
+
+## YAML
+
+Key-value pairs, nested objects, lists.
+
+```yaml
+name: John
+items:
+ - a
+ - b
+ - c
+config:
+ env: production
+```
+
+```bash
+cat config.yaml | div render template.tpl
+```
+
+## XML
+
+Elements become nested keys. Attributes are prefixed with `@`.
+
+```xml
+
+
+ 123 Main St
+
+```
+
+Template access:
+```tpl
+{$user.@name} => "John"
+{$user.@email} => "john@example.com"
+{$user.address} => "123 Main St"
+```
+
+### Multiple Elements (Arrays)
+
+```xml
+
+
+
+
+```
+
+Template access:
+```tpl
+{$employees.employee[0].@name} => "John"
+{$employees.employee[1].@name} => "Jane"
+```
+
+## PHP
+
+Files that return an array. Enables dynamic data generation.
+
+```php
+ "John",
+ "timestamp" => time(),
+ "config" => [
+ "env" => getenv("APP_ENV") ?: "production"
+ ]
+];
+```
+
+```bash
+div render template.tpl --input=generate.php
+```
+
+## Auto-Detection
+
+Format is auto-detected based on:
+- `{` or `[` → JSON
+- `<` → XML
+- ` Official documentation for the Divengine CLI tool.
+
+## Table of Contents
+
+1. [Installation](01.Installation.md)
+2. [Commands](02.Commands.md)
+3. [Input Formats](03.Input-Formats.md)
+
+For template syntax, see [divengine/div documentation](https://github.com/divengine/div/tree/main/docs).
+
+## Overview
+
+Div CLI is a focused tool for **template generation and transformation**. It uses the divengine/div template engine for rendering.
+
+## Quick Start
+
+```bash
+# Install
+curl -sSL https://raw.githubusercontent.com/divengine/cli/main/install | php
+
+# Use
+echo '{"name": "World"}' | div render template.tpl
+```
+
+## Architecture
+
+```
+div CLI
+├── render Render templates with input data
+├── transform Transform data through templates
+├── build Build artifacts from templates
+└── ...
+```
diff --git a/install b/install
new file mode 100644
index 0000000..24711f7
--- /dev/null
+++ b/install
@@ -0,0 +1,223 @@
+#!/usr/bin/env php
+&1', $output, $returnCode);
+
+ if ($returnCode !== 0) {
+ echo " ❌ Build failed:\n";
+ echo " " . implode("\n ", $output) . "\n\n";
+ exit(1);
+ }
+
+ echo " ✓ PHAR built successfully\n\n";
+
+ if (!file_exists($localPhar)) {
+ echo " ❌ PHAR was not created.\n\n";
+ exit(1);
+ }
+ } else {
+ echo " ✓ Using existing local PHAR\n\n";
+ }
+
+ // Copy local PHAR to install location
+ if (!copy($localPhar, $pharPath)) {
+ echo " ❌ Failed to copy PHAR to {$pharPath}\n";
+ echo " Check permissions.\n\n";
+ exit(1);
+ }
+
+ echo " ✓ Copied div.phar to {$installDir}\n";
+
+} else {
+ // REMOTE INSTALLATION (from GitHub)
+ echo " Mode: Remote (production)\n\n";
+
+ echo " Fetching latest release from GitHub...\n";
+
+ $context = stream_context_create([
+ 'http' => [
+ 'method' => 'GET',
+ 'header' => "User-Agent: div-installer/1.0\r\n",
+ 'timeout' => 30,
+ 'ignore_errors' => true,
+ ]
+ ]);
+
+ $apiUrl = 'https://api.github.com/repos/divengine/cli/releases/latest';
+ $response = @file_get_contents($apiUrl, false, $context);
+
+ if ($response === false) {
+ echo " ❌ Failed to fetch release info.\n";
+ echo " Check your internet connection.\n\n";
+ exit(1);
+ }
+
+ $release = json_decode($response, true);
+
+ if (json_last_error() !== JSON_ERROR_NONE || !isset($release['tag_name'])) {
+ echo " ❌ Failed to parse release info.\n\n";
+ exit(1);
+ }
+
+ $version = $release['tag_name'];
+ $downloadUrl = null;
+
+ foreach ($release['assets'] ?? [] as $asset) {
+ if ($asset['name'] === 'div.phar') {
+ $downloadUrl = $asset['browser_download_url'];
+ break;
+ }
+ }
+
+ if ($downloadUrl === null) {
+ echo " ❌ div.phar not found in latest release.\n";
+ echo " Version: {$version}\n\n";
+ exit(1);
+ }
+
+ echo " Version: {$version}\n";
+ echo " Source: {$downloadUrl}\n\n";
+ echo " Downloading...\n";
+
+ $downloadContext = stream_context_create([
+ 'http' => [
+ 'method' => 'GET',
+ 'header' => "User-Agent: div-installer/1.0\r\n",
+ 'timeout' => 120,
+ ],
+ ]);
+
+ $pharContent = @file_get_contents($downloadUrl, false, $downloadContext);
+
+ if ($pharContent === false) {
+ echo " ❌ Failed to download div.phar.\n\n";
+ exit(1);
+ }
+
+ if (file_put_contents($pharPath, $pharContent) === false) {
+ echo " ❌ Failed to write {$pharPath}\n";
+ echo " Check permissions.\n\n";
+ exit(1);
+ }
+
+ echo " ✓ Downloaded div.phar\n";
+}
+
+// Make executable on Unix
+if (!$isWindows) {
+ chmod($pharPath, 0755);
+}
+
+echo "\n";
+echo " ─────────────────────────────────────\n";
+echo " ✓ Installation complete!\n";
+echo " ─────────────────────────────────────\n\n";
+
+if ($isWindows) {
+ echo " Run: php {$pharPath} --help\n";
+ echo "\n";
+ echo " To use without 'php', add {$installDir} to your PATH.\n";
+} else {
+ echo " Run: {$pharPath} --help\n";
+ echo " Or: chmod +x {$pharPath} && {$pharPath} --help\n";
+}
+
+echo "\n";
+echo " Learn more: https://github.com/divengine/cli\n";
+echo "\n";
diff --git a/install.bat b/install.bat
new file mode 100644
index 0000000..1653a6e
--- /dev/null
+++ b/install.bat
@@ -0,0 +1,118 @@
+@echo off
+setlocal enabledelayedexpansion
+
+echo.
+echo div CLI Installer (Windows)
+echo ─────────────────────────────
+echo.
+
+:: Check for --from-here flag
+set "FROM_HERE="
+echo %* | findstr /i "--from-here" >nul
+if not errorlevel 1 set "FROM_HERE=1"
+
+:: Get install directory from command line or use default
+set "INSTALL_DIR=%USERPROFILE%\bin"
+
+:: Create install directory if needed
+if not exist "%INSTALL_DIR%" (
+ mkdir "%INSTALL_DIR%"
+)
+
+set "PHAR_PATH=%INSTALL_DIR%\div.phar"
+set "SCRIPT_DIR=%~dp0"
+set "PROJECT_ROOT=%SCRIPT_DIR%.."
+set "LOCAL_PHAR=%PROJECT_ROOT%\build\div.phar"
+
+echo Install to: %INSTALL_DIR%
+echo.
+
+if defined FROM_HERE (
+ echo Mode: From here (development)
+ echo Source: %PROJECT_ROOT%
+ echo.
+
+ if not exist "%LOCAL_PHAR%" (
+ echo [INFO] No local PHAR found. Building from source...
+ echo.
+ echo Running: php build\build-phar.php
+ call php -d phar.readonly=0 "%PROJECT_ROOT%\build\build-phar.php"
+
+ if not exist "%LOCAL_PHAR%" (
+ echo [ERROR] PHAR was not created.
+ exit /b 1
+ )
+
+ echo [OK] PHAR built successfully
+ ) else (
+ echo [OK] Using existing local PHAR
+ )
+ echo.
+
+ copy /Y "%LOCAL_PHAR%" "%PHAR_PATH%" >nul
+ if errorlevel 1 (
+ echo [ERROR] Failed to copy PHAR.
+ exit /b 1
+ )
+ echo [OK] Copied div.phar to %INSTALL_DIR%
+
+) else (
+ echo Mode: Remote (production)
+ echo.
+
+ echo Fetching latest release from GitHub...
+ set "GITHUB_API=https://api.github.com/repos/divengine/cli/releases/latest"
+
+ curl -sL -A "div-installer/1.0" "%GITHUB_API%" -o "%TEMP%\div_release.json"
+
+ if not exist "%TEMP%\div_release.json" (
+ echo [ERROR] Failed to fetch release info.
+ exit /b 1
+ )
+
+ :: Extract version and download URL
+ for /f "tokens=1* delims=:," %%a in ('findstr /C:"\"tag_name\"" "%TEMP%\div_release.json"') do (
+ set "VERSION=%%b"
+ set "VERSION=!VERSION:"=!"
+ set "VERSION=!VERSION: =!"
+ )
+
+ findstr /C:"\"browser_download_url\"" "%TEMP%\div_release.json" | findstr "div.phar" > "%TEMP%\div_url.txt"
+ set /p DOWNLOAD_URL=<"%TEMP%\div_url.txt"
+
+ :: Clean up URLs
+ set "DOWNLOAD_URL=!DOWNLOAD_URL:*: =!"
+ set "DOWNLOAD_URL=!DOWNLOAD_URL:,=!"
+ set "DOWNLOAD_URL=!DOWNLOAD_URL:"=!"
+
+ echo Version: !VERSION!
+ echo Source: !DOWNLOAD_URL!
+ echo.
+ echo Downloading...
+
+ curl -sL -A "div-installer/1.0" "!DOWNLOAD_URL!" -o "%PHAR_PATH%"
+
+ if not exist "%PHAR_PATH%" (
+ echo [ERROR] Failed to download div.phar.
+ exit /b 1
+ )
+ echo [OK] Downloaded div.phar
+
+ :: Cleanup
+ del "%TEMP%\div_release.json" 2>nul
+ del "%TEMP%\div_url.txt" 2>nul
+)
+
+echo.
+echo ================================================
+echo [OK] Installation complete!
+echo ================================================
+echo.
+echo Run: php %PHAR_PATH% --help
+echo.
+echo To use without 'php', add %INSTALL_DIR% to your PATH.
+echo.
+echo Learn more: https://github.com/divengine/cli
+echo.
+
+endlocal
diff --git a/install.ps1 b/install.ps1
new file mode 100644
index 0000000..e7ea99d
--- /dev/null
+++ b/install.ps1
@@ -0,0 +1,146 @@
+# div CLI Installer for Windows (PowerShell)
+#
+# Usage:
+# # Install from local source (development)
+# php install --from-here
+#
+# # Download from GitHub releases (production)
+# irm https://raw.githubusercontent.com/divengine/cli/main/install.ps1 | iex
+
+param(
+ [switch]$FromHere,
+ [string]$InstallDir = "$env:USERPROFILE\bin"
+)
+
+$ErrorActionPreference = "Stop"
+
+Write-Host ""
+Write-Host " div CLI Installer (Windows)" -ForegroundColor Gray
+Write-Host " ─────────────────────────────" -ForegroundColor Gray
+Write-Host ""
+
+# Determine project root (where this script is located)
+$ScriptPath = $PSCommandPath
+if (-not $ScriptPath) {
+ $ScriptPath = $MyInvocation.MyCommand.Path
+}
+$ProjectRoot = Split-Path -Parent $ScriptPath
+
+Write-Host " Install to: $InstallDir" -ForegroundColor Gray
+Write-Host ""
+
+# Create install directory if needed
+if (-not (Test-Path $InstallDir)) {
+ Write-Host " Creating directory: $InstallDir" -ForegroundColor Gray
+ New-Item -ItemType Directory -Path $InstallDir -Force | Out-Null
+}
+
+$PharPath = Join-Path $InstallDir "div.phar"
+
+# Check for local source
+$LocalPhar = Join-Path $ProjectRoot "build\div.phar"
+$HasLocalPhar = Test-Path $LocalPhar
+$HasComposerJson = Test-Path (Join-Path $ProjectRoot "composer.json")
+
+if ($FromHere -or ($HasLocalPhar -and $HasComposerJson)) {
+ # LOCAL INSTALLATION
+ Write-Host " Mode: From here (development)" -ForegroundColor Cyan
+ Write-Host " Source: $ProjectRoot" -ForegroundColor Gray
+ Write-Host ""
+
+ if (-not $HasLocalPhar) {
+ Write-Host " [!] No local PHAR found." -ForegroundColor Yellow
+ Write-Host " Building PHAR from source..." -ForegroundColor Yellow
+ Write-Host ""
+
+ # Build PHAR
+ $BuildScript = Join-Path $ProjectRoot "build\build-phar.php"
+ if (-not (Test-Path $BuildScript)) {
+ Write-Host " [ERROR] Build script not found: $BuildScript" -ForegroundColor Red
+ exit 1
+ }
+
+ Write-Host " Running: php build/build-phar.php" -ForegroundColor Gray
+ $null = iex "php -d phar.readonly=0 `"$BuildScript`" 2>&1"
+
+ if (-not (Test-Path $LocalPhar)) {
+ Write-Host " [ERROR] PHAR was not created." -ForegroundColor Red
+ exit 1
+ }
+
+ Write-Host " [OK] PHAR built successfully" -ForegroundColor Green
+ } else {
+ Write-Host " [OK] Using existing local PHAR" -ForegroundColor Green
+ }
+ Write-Host ""
+
+ # Copy local PHAR to install location
+ Copy-Item -Path $LocalPhar -Destination $PharPath -Force
+
+ Write-Host " [OK] Copied div.phar to $InstallDir" -ForegroundColor Green
+ Write-Host ""
+
+} else {
+ # REMOTE INSTALLATION
+ Write-Host " Mode: Remote (production)" -ForegroundColor Cyan
+ Write-Host ""
+
+ Write-Host " Fetching latest release from GitHub..." -ForegroundColor Gray
+
+ try {
+ $Headers = @{ "User-Agent" = "div-installer/1.0" }
+ $Response = Invoke-RestMethod -Uri "https://api.github.com/repos/divengine/cli/releases/latest" -Headers $Headers -TimeoutSec 30
+ } catch {
+ Write-Host " [ERROR] Failed to fetch release info." -ForegroundColor Red
+ Write-Host " Check your internet connection." -ForegroundColor Red
+ exit 1
+ }
+
+ $Version = $Response.tag_name
+ $DownloadUrl = $null
+
+ foreach ($Asset in $Response.assets) {
+ if ($Asset.name -eq "div.phar") {
+ $DownloadUrl = $Asset.browser_download_url
+ break
+ }
+ }
+
+ if (-not $DownloadUrl) {
+ Write-Host " [ERROR] div.phar not found in latest release." -ForegroundColor Red
+ Write-Host " Version: $Version" -ForegroundColor Red
+ exit 1
+ }
+
+ Write-Host " Version: $Version" -ForegroundColor Gray
+ Write-Host " Source: $DownloadUrl" -ForegroundColor Gray
+ Write-Host ""
+
+ Write-Host " Downloading..." -ForegroundColor Gray
+
+ try {
+ $WebClient = New-Object System.Net.WebClient
+ $WebClient.Headers.Add("User-Agent", "div-installer/1.0")
+ $WebClient.DownloadFile($DownloadUrl, $PharPath)
+ $WebClient.Dispose()
+ } catch {
+ Write-Host " [ERROR] Failed to download div.phar." -ForegroundColor Red
+ exit 1
+ }
+
+ Write-Host " [OK] Downloaded div.phar" -ForegroundColor Green
+ Write-Host ""
+}
+
+Write-Host " ─────────────────────────────────────" -ForegroundColor Gray
+Write-Host " [OK] Installation complete!" -ForegroundColor Green
+Write-Host " ─────────────────────────────────────" -ForegroundColor Gray
+Write-Host ""
+
+Write-Host " Run: php $PharPath --help" -ForegroundColor White
+Write-Host ""
+Write-Host " To use without 'php', add $InstallDir to your PATH:" -ForegroundColor Gray
+Write-Host " [Environment]::SetEnvironmentVariable('Path', \$env:Path + ';$InstallDir', 'User')" -ForegroundColor Cyan
+Write-Host ""
+Write-Host " Learn more: https://github.com/divengine/cli" -ForegroundColor Gray
+Write-Host ""
diff --git a/phpstan.neon b/phpstan.neon
new file mode 100644
index 0000000..3b66c4a
--- /dev/null
+++ b/phpstan.neon
@@ -0,0 +1,5 @@
+parameters:
+ level: 4
+ paths:
+ - src
+ treatPhpDocTypesAsCertain: false
diff --git a/phpunit.xml b/phpunit.xml
new file mode 100644
index 0000000..b526646
--- /dev/null
+++ b/phpunit.xml
@@ -0,0 +1,16 @@
+
+
+
+
+ tests
+
+
+
diff --git a/releases/v1.0.0.md b/releases/v1.0.0.md
new file mode 100644
index 0000000..36fc59b
--- /dev/null
+++ b/releases/v1.0.0.md
@@ -0,0 +1,61 @@
+# Release v1.0.0
+
+## Summary
+
+Initial release of div CLI - Official runtime and package manager for the Divengine template ecosystem.
+
+## What's New
+
+### Commands
+
+- `render` - Render templates with input data
+- `transform` - Transform data through templates (alias for render)
+- `build` - Build artifacts from templates
+- `doctor` - Run environment diagnostics
+- `templates` - List available templates
+- `packages` - List packages in vendor directory
+- `resolve` - Resolve template identifiers to physical paths
+
+### Input Formats
+
+- **JSON** - Standard JSON objects and arrays
+- **YAML** - Key-value pairs, nested objects, lists
+- **XML** - Elements as nested keys, `@` prefix for attributes
+- **PHP** - Files that return arrays (dynamic data generation)
+
+### Features
+
+- Stdin support (pipe data without `--input` flag)
+- Auto-detection of input format
+- Cross-platform ANSI colored output
+- PHAR distribution for easy installation
+- Self-contained builds (no dependencies needed)
+
+## Installation
+
+```bash
+# Unix/macOS
+curl -sSL https://raw.githubusercontent.com/divengine/cli/main/install | php
+
+# Windows (PowerShell)
+irm https://raw.githubusercontent.com/divengine/cli/main/install.ps1 | iex
+```
+
+## Requirements
+
+- PHP >= 8.1
+
+## Quick Start
+
+```bash
+# Create a template
+echo 'Hello, {$name}!' > greet.tpl
+
+# Render with data
+echo '{"name": "World"}' | div render greet.tpl
+# Output: Hello, World!
+```
+
+## Credits
+
+Built with [divengine/div](https://github.com/divengine/div) template engine.
diff --git a/scripts/build_pdf.py b/scripts/build_pdf.py
new file mode 100644
index 0000000..a0f9a3d
--- /dev/null
+++ b/scripts/build_pdf.py
@@ -0,0 +1,81 @@
+#!/usr/bin/env python3
+"""
+Build PDF documentation from Markdown files.
+
+Usage:
+ python scripts/build_pdf.py --output div-documentation.pdf
+
+Requirements:
+ - pandoc
+ - texlive (xetex, latex-recommended, latex-extra, fonts-recommended)
+"""
+
+import argparse
+import subprocess
+import sys
+from pathlib import Path
+
+
+def find_markdown_files(docs_dir: Path) -> list[Path]:
+ """Find all markdown files in docs directory, sorted."""
+ md_files = sorted(docs_dir.glob("*.md"))
+ return [f for f in md_files if f.name != "README.md"]
+
+
+def build_pdf(markdown_files: list[Path], output: Path, title: str = "Div CLI Documentation") -> None:
+ """Build PDF from markdown files using pandoc."""
+
+ cmd = [
+ "pandoc",
+ "--pdf-engine=xelatex",
+ "-f", "markdown",
+ "-o", str(output),
+ "--standalone",
+ f"--title={title}",
+ "--toc",
+ "--toc-depth=2",
+ "-V", "geometry:margin=1in",
+ "-V", "fontsize=11pt",
+ "-V", "linestretch=1.2",
+ ]
+
+ cmd.extend([str(f) for f in markdown_files])
+
+ print(f"Building PDF: {output}")
+ print(f"Source files: {len(markdown_files)}")
+
+ result = subprocess.run(cmd, capture_output=True, text=True)
+
+ if result.returncode != 0:
+ print(f"Error: {result.stderr}", file=sys.stderr)
+ sys.exit(1)
+
+ print(f"PDF created: {output} ({output.stat().st_size / 1024:.1f} KB)")
+
+
+def main():
+ parser = argparse.ArgumentParser(description="Build PDF from Markdown documentation")
+ parser.add_argument("--output", "-o", required=True, help="Output PDF file")
+ parser.add_argument("--title", "-t", default="Div CLI Documentation", help="Document title")
+ parser.add_argument("--docs", "-d", default="docs", help="Documentation directory")
+
+ args = parser.parse_args()
+
+ docs_dir = Path(args.docs)
+ if not docs_dir.exists():
+ print(f"Error: Documentation directory not found: {docs_dir}", file=sys.stderr)
+ sys.exit(1)
+
+ markdown_files = find_markdown_files(docs_dir)
+
+ if not markdown_files:
+ print(f"Error: No markdown files found in {docs_dir}", file=sys.stderr)
+ sys.exit(1)
+
+ output = Path(args.output)
+
+ build_pdf(markdown_files, output, args.title)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/scripts/generate_release_notes.py b/scripts/generate_release_notes.py
new file mode 100644
index 0000000..bc20356
--- /dev/null
+++ b/scripts/generate_release_notes.py
@@ -0,0 +1,6 @@
+# Release Notes Generator
+
+Generates release notes from changelog entries.
+
+Usage:
+ python scripts/generate_release_notes.py [version]
diff --git a/src/cli/Application.php b/src/cli/Application.php
new file mode 100644
index 0000000..051bf42
--- /dev/null
+++ b/src/cli/Application.php
@@ -0,0 +1,115 @@
+registerDefaultCommands();
+ }
+
+ private function registerDefaultCommands(): void
+ {
+ $this->register(new \divengine\commands\HelpCommand($this));
+ $this->register(new \divengine\commands\VersionCommand($this));
+ $this->register(new \divengine\commands\RenderCommand());
+ $this->register(new \divengine\commands\BuildCommand());
+ $this->register(new \divengine\commands\TemplatesCommand());
+ $this->register(new \divengine\commands\PackagesCommand());
+ }
+
+ public function register(Command $command): void
+ {
+ $this->commands[$command->getName()] = $command;
+ }
+
+ public function getCommands(): array
+ {
+ return $this->commands;
+ }
+
+ public function getVersion(): string
+ {
+ return $this->version;
+ }
+
+ public function run(array $argv): int
+ {
+ array_shift($argv);
+
+ if (empty($argv) || $this->isHelpFlag($argv[0])) {
+ return $this->runHelp();
+ }
+
+ $commandName = $argv[0];
+
+ if (!isset($this->commands[$commandName])) {
+ \divengine\utils\Console::error("Unknown command: {$commandName}");
+ \divengine\utils\Console::info("Run 'div help' for available commands.");
+ return 1;
+ }
+
+ $command = $this->commands[$commandName];
+ $args = array_slice($argv, 1);
+
+ if ($this->hasHelpFlag($args)) {
+ return $command->showHelp();
+ }
+
+ try {
+ return $command->run($args);
+ } catch (\Throwable $e) {
+ \divengine\utils\Console::error($e->getMessage());
+ return 1;
+ }
+ }
+
+ private function isHelpFlag(string $arg): bool
+ {
+ return $arg === '--help' || $arg === '-h';
+ }
+
+ private function hasHelpFlag(array $args): bool
+ {
+ foreach ($args as $arg) {
+ if ($arg === '--help' || $arg === '-h') {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private function runHelp(): int
+ {
+ return $this->commands['help']->run([]);
+ }
+}
diff --git a/src/cli/Command.php b/src/cli/Command.php
new file mode 100644
index 0000000..e277a3d
--- /dev/null
+++ b/src/cli/Command.php
@@ -0,0 +1,103 @@
+name;
+ }
+
+ public function getDescription(): string
+ {
+ return $this->description;
+ }
+
+ public function getUsage(): string
+ {
+ return $this->usage ?: "div {$this->name}";
+ }
+
+ public function getHelp(): string
+ {
+ return $this->help;
+ }
+
+ public function showHelp(): int
+ {
+ Console::line();
+
+ Console::segments([
+ ['text' => 'Usage: ', 'color' => Console::CYAN, 'bold' => true],
+ ['text' => $this->getUsage()],
+ ]);
+
+ Console::line();
+
+ if ($this->description) {
+ Console::line(' ' . $this->description);
+ Console::line();
+ }
+
+ if ($this->help) {
+ Console::dim(str_repeat('-', 50));
+ Console::line($this->help);
+ Console::dim(str_repeat('-', 50));
+ Console::line();
+ }
+
+ Console::note("Run 'div help' for available commands.");
+
+ return 0;
+ }
+
+ abstract public function run(array $args): int;
+
+ protected function getOption(string $key, array $args, mixed $default = null): mixed
+ {
+ foreach ($args as $arg) {
+ if (str_starts_with($arg, "--{$key}=")) {
+ return substr($arg, strlen($key) + 3);
+ }
+ }
+ return $default;
+ }
+
+ protected function hasFlag(string $flag, array $args): bool
+ {
+ return in_array("--{$flag}", $args, true);
+ }
+}
diff --git a/src/commands/BuildCommand.php b/src/commands/BuildCommand.php
new file mode 100644
index 0000000..937e8ce
--- /dev/null
+++ b/src/commands/BuildCommand.php
@@ -0,0 +1,173 @@
+ [--input=file] [--out-dir=DIR] [--dry-run] [--format=FMT]';
+ protected string $help = 'Build one or more artifacts from templates.
+
+This command renders a template with input data and writes the output to a file.
+Designed for generating final artifacts (config files, source code, etc.).
+
+USAGE:
+ div build template.tpl --input=data.json --out-dir=dist
+ cat data.json | div build template.tpl --out-dir=generated
+
+ARGUMENTS:
+ Path to the template file
+
+OPTIONS:
+ --input=FILE Input file (JSON, YAML, XML, or PHP). If omitted, reads from stdin.
+ --format=FMT Force input format (json, yaml, xml, php). Auto-detected if omitted.
+ --out-dir=DIR Output directory (created if it does not exist)
+ --dry-run Show what would be built without writing files
+ -h, --help Show this help message
+
+OUTPUT:
+ Output filename is based on template name: template.tpl -> template.txt
+ Use --output=FILE for a custom output name.
+
+EXAMPLES:
+ # Dry run - preview what will be built
+ div build template.tpl --input=data.json --dry-run
+
+ # Build to output directory
+ div build template.tpl --input=data.json --out-dir=dist
+
+ # Build from stdin
+ cat config.yaml | div build template.tpl --out-dir=generated
+
+ # With PHP dynamic data
+ div build template.tpl --input=generate.php --out-dir=output
+
+See "div render --help" for detailed format documentation.';
+
+ public function run(array $args): int
+ {
+ $parser = new ArgParser($args);
+ $template = $parser->getPositional(0);
+ $inputFile = $parser->getOption('input');
+ $outDir = $parser->getOption('out-dir');
+ $dryRun = $parser->hasFlag('dry-run');
+ $format = $parser->getOption('format');
+
+ if (empty($template)) {
+ Console::error('Template name is required.');
+ Console::note('Run "div build --help" for usage information.');
+ return 1;
+ }
+
+ $templatePath = Filesystem::absolutePath($template);
+
+ if (!Filesystem::exists($templatePath)) {
+ Console::error("Template file not found: {$template}");
+ return 1;
+ }
+
+ $data = [];
+
+ if ($inputFile) {
+ if (!Filesystem::exists($inputFile)) {
+ Console::error("Input file not found: {$inputFile}");
+ return 1;
+ }
+
+ try {
+ $data = InputParser::parseFile($inputFile, $format);
+ } catch (\Throwable $e) {
+ Console::error("Failed to parse input: " . $e->getMessage());
+ return 1;
+ }
+ } elseif (InputParser::hasStdinData()) {
+ try {
+ $data = InputParser::parseStdin($format);
+ } catch (\Throwable $e) {
+ Console::error("Failed to parse stdin: " . $e->getMessage());
+ return 1;
+ }
+ }
+
+ $runner = new TemplateRunner();
+ $templateName = pathinfo($template, PATHINFO_FILENAME);
+ $outputFile = ($outDir ? rtrim($outDir, '/\\') . DIRECTORY_SEPARATOR : '') . $templateName . '.txt';
+
+ Console::segments([
+ ['text' => '[build] ', 'color' => Console::CYAN, 'bold' => true],
+ ['text' => $template, 'color' => Console::YELLOW],
+ ]);
+
+ if ($dryRun) {
+ Console::warning('Dry run mode - no files will be written');
+ Console::line();
+ Console::label('Build Plan:');
+ Console::kv('Template', Filesystem::absolutePath($template));
+ Console::kv('Input', $inputFile ?: '(none)');
+ Console::kv('Output', $outputFile);
+ Console::kv('Out Dir', $outDir ?: '(current directory)');
+ Console::line();
+ Console::note('Run without --dry-run to execute.');
+ return 0;
+ }
+
+ try {
+ Console::progress('Building...');
+
+ $result = $runner->render($templatePath, $data);
+
+ if ($outDir) {
+ Filesystem::ensureDir($outDir);
+ }
+
+ Filesystem::writeFile($outputFile, $result);
+ Console::clearProgress();
+
+ Console::segments([
+ ['text' => '[build] ', 'color' => Console::GREEN, 'bold' => true],
+ ['text' => $outputFile, 'color' => Console::YELLOW],
+ ['text' => ' -> ', 'color' => Console::GRAY],
+ ['text' => 'OK', 'color' => Console::GREEN, 'bold' => true],
+ ]);
+ } catch (\Throwable $e) {
+ Console::clearProgress();
+ Console::error($e->getMessage());
+ return 1;
+ }
+
+ return 0;
+ }
+}
diff --git a/src/commands/HelpCommand.php b/src/commands/HelpCommand.php
new file mode 100644
index 0000000..28d6214
--- /dev/null
+++ b/src/commands/HelpCommand.php
@@ -0,0 +1,100 @@
+getPositional(0);
+
+ if ($commandName) {
+ return $this->showCommandHelp($commandName);
+ }
+
+ return $this->showAllCommands();
+ }
+
+ private function showCommandHelp(string $commandName): int
+ {
+ $commands = $this->app->getCommands();
+
+ if (!isset($commands[$commandName])) {
+ Console::error("Unknown command: {$commandName}");
+ Console::line();
+ Console::info("Run 'div help' to see all available commands.");
+ return 1;
+ }
+
+ $command = $commands[$commandName];
+ $command->showHelp();
+
+ return 0;
+ }
+
+ private function showAllCommands(): int
+ {
+ Console::header('Divengine CLI');
+ Console::line();
+
+ $commands = $this->app->getCommands();
+ foreach ($commands as $command) {
+ Console::segments([
+ ['text' => ' ' . str_pad($command->getName(), 12), 'color' => Console::CYAN, 'bold' => true],
+ ['text' => $command->getDescription()],
+ ]);
+ }
+
+ Console::line();
+ Console::note("Run 'div help ' or 'div --help' for details.");
+
+ return 0;
+ }
+}
diff --git a/src/commands/PackagesCommand.php b/src/commands/PackagesCommand.php
new file mode 100644
index 0000000..a5c7283
--- /dev/null
+++ b/src/commands/PackagesCommand.php
@@ -0,0 +1,89 @@
+getPositional(0);
+
+ $inspector = new PackageInspector($vendorPath);
+
+ if ($vendorPath && !$inspector->hasVendorDir()) {
+ Console::error("Vendor directory not found: {$vendorPath}");
+ return 1;
+ }
+
+ $packages = $inspector->listPackages();
+
+ if (empty($packages)) {
+ Console::warning('No packages found in vendor/ directory.');
+ Console::line();
+ Console::note('Run "composer install" to install dependencies.');
+ return 0;
+ }
+
+ Console::header('Detected Packages');
+ Console::line();
+
+ foreach ($packages as $package) {
+ Console::segments([
+ ['text' => ' ' . $package['name'], 'color' => Console::CYAN, 'bold' => true],
+ ]);
+ if ($package['description']) {
+ Console::dim(' ' . $package['description']);
+ }
+ }
+
+ Console::line();
+ Console::note('Found ' . count($packages) . ' package(s)');
+
+ return 0;
+ }
+}
diff --git a/src/commands/RenderCommand.php b/src/commands/RenderCommand.php
new file mode 100644
index 0000000..f83e732
--- /dev/null
+++ b/src/commands/RenderCommand.php
@@ -0,0 +1,206 @@
+ [--input=file] [--output=file] [--format=FMT]';
+ protected string $help = 'Render a template file with the provided input data.
+
+The template is processed using the divengine/div engine with {$variable} syntax.
+
+USAGE:
+ div render template.tpl --input=data.json
+ echo \'{"name": "World"}\' | div render template.tpl
+
+ARGUMENTS:
+ Path to the template file
+
+OPTIONS:
+ --input=FILE Input file (JSON, YAML, XML, or PHP). If omitted, reads from stdin.
+ --format=FMT Force input format (json, yaml, xml, php). Auto-detected if omitted.
+ --output=FILE Output file (default: stdout)
+ -h, --help Show this help message
+
+INPUT FORMATS:
+ JSON: Standard JSON objects and arrays
+ YAML: Key-value pairs, nested objects, lists
+ XML: Elements become nested keys, @attr for attributes
+ PHP: File must return array, enables dynamic data
+
+EXAMPLES:
+ # With input file
+ div render template.tpl --input=data.json
+
+ # Pipe JSON from stdin (Linux/macOS)
+ echo \'{"name": "World"}\' | div render template.tpl
+
+ # Pipe YAML from stdin
+ cat config.yaml | div render template.tpl
+
+ # Pipe XML from stdin
+ echo \'john@example.com\' | div render template.tpl
+
+ # Save output to file
+ div render template.tpl --input=data.json --output=result.txt
+
+ # Force format for unrecognized extensions
+ div render template.tpl --input=data.txt --format=yaml
+
+XML CONVENTION:
+ Attributes are prefixed with @:
+
+ 123 Main St
+
+
+ Template access:
+ {$user.@name} => "John"
+ {$user.@email} => "john@example.com"
+ {$user.address} => "123 Main St"
+
+ Multiple children become arrays:
+
+
+
+
+
+ Template access:
+ {$employees.employee[0].@name} => "John"
+ {$employees.employee[1].@name} => "Jane"
+
+PHP CONVENTION:
+ File must return an array:
+ "John",
+ "timestamp" => time(),
+ "config" => [
+ "env" => getenv("APP_ENV") ?: "production"
+ ]
+ ];
+
+ Use PHP input for dynamic data generation:
+ div render template.tpl --input=generate.php';
+
+ public function run(array $args): int
+ {
+ $parser = new ArgParser($args);
+ $template = $parser->getPositional(0);
+ $inputFile = $parser->getOption('input');
+ $outputFile = $parser->getOption('output');
+ $format = $parser->getOption('format');
+
+ if (empty($template)) {
+ Console::error('Template name is required.');
+ Console::note('Run "div render --help" for usage information.');
+ return 1;
+ }
+
+ $templatePath = Filesystem::absolutePath($template);
+
+ if (!Filesystem::exists($templatePath)) {
+ Console::error("Template file not found: {$template}");
+ return 1;
+ }
+
+ Console::segments([
+ ['text' => '[render] ', 'color' => Console::CYAN, 'bold' => true],
+ ['text' => $template, 'color' => Console::YELLOW],
+ ]);
+
+ $data = [];
+
+ if ($inputFile) {
+ if (!Filesystem::exists($inputFile)) {
+ Console::error("Input file not found: {$inputFile}");
+ return 1;
+ }
+
+ try {
+ $data = InputParser::parseFile($inputFile, $format);
+ } catch (\Throwable $e) {
+ Console::error("Failed to parse input: " . $e->getMessage());
+ return 1;
+ }
+
+ Console::segments([
+ ['text' => '[input] ', 'color' => Console::CYAN, 'bold' => true],
+ ['text' => $inputFile, 'color' => Console::YELLOW],
+ ]);
+ } elseif (InputParser::hasStdinData()) {
+ try {
+ $data = InputParser::parseStdin($format);
+ } catch (\Throwable $e) {
+ Console::error("Failed to parse stdin: " . $e->getMessage());
+ return 1;
+ }
+
+ Console::segments([
+ ['text' => '[input] ', 'color' => Console::CYAN, 'bold' => true],
+ ['text' => '', 'color' => Console::GRAY],
+ ]);
+ }
+
+ Console::progress('Rendering...');
+
+ $runner = new TemplateRunner();
+
+ try {
+ $result = $runner->render($templatePath, $data);
+ Console::clearProgress();
+
+ if ($outputFile) {
+ Filesystem::writeFile($outputFile, $result);
+ Console::segments([
+ ['text' => '[output] ', 'color' => Console::GREEN, 'bold' => true],
+ ['text' => $outputFile, 'color' => Console::YELLOW],
+ ['text' => ' -> ', 'color' => Console::GRAY],
+ ['text' => 'OK', 'color' => Console::GREEN, 'bold' => true],
+ ]);
+ } else {
+ Console::line();
+ Console::line($result);
+ }
+ } catch (\Throwable $e) {
+ Console::clearProgress();
+ Console::error($e->getMessage());
+ return 1;
+ }
+
+ return 0;
+ }
+}
diff --git a/src/commands/TemplatesCommand.php b/src/commands/TemplatesCommand.php
new file mode 100644
index 0000000..b193bcf
--- /dev/null
+++ b/src/commands/TemplatesCommand.php
@@ -0,0 +1,155 @@
+searchRoots = [
+ getcwd(),
+ getcwd() . '/templates',
+ getcwd() . '/templates/src',
+ ];
+ }
+
+ public function run(array $args): int
+ {
+ $parser = new ArgParser($args);
+ $path = $parser->getPositional(0);
+
+ if ($path) {
+ return $this->listFromPath($path);
+ }
+
+ return $this->listFromDefaultLocations();
+ }
+
+ private function listFromPath(string $path): int
+ {
+ $fullPath = Filesystem::absolutePath($path);
+
+ if (!Filesystem::isDir($fullPath)) {
+ Console::error("Directory not found: {$path}");
+ return 1;
+ }
+
+ $templates = Filesystem::listTemplates($fullPath);
+
+ if (empty($templates)) {
+ Console::warning("No .tpl or .div files found in: {$fullPath}");
+ return 0;
+ }
+
+ Console::header("Templates in {$path}");
+ Console::line();
+
+ foreach ($templates as $template) {
+ $ext = $template['extension'] ?? 'tpl';
+ Console::segments([
+ ['text' => ' ' . str_pad($template['name'], 20), 'color' => Console::CYAN, 'bold' => true],
+ ['text' => '.', 'color' => Console::GRAY],
+ ['text' => $ext, 'color' => Console::YELLOW],
+ ['text' => ' ' . $template['path'], 'color' => Console::GRAY],
+ ]);
+ }
+
+ Console::line();
+ Console::note('Found ' . count($templates) . ' template(s)');
+
+ return 0;
+ }
+
+ private function listFromDefaultLocations(): int
+ {
+ $allTemplates = [];
+ $foundLocations = [];
+
+ foreach ($this->searchRoots as $root) {
+ if (!Filesystem::isDir($root)) {
+ continue;
+ }
+
+ $templates = Filesystem::listTemplates($root);
+
+ if (!empty($templates)) {
+ $allTemplates = array_merge($allTemplates, $templates);
+ $foundLocations[] = $root;
+ }
+ }
+
+ if (empty($allTemplates)) {
+ Console::warning('No templates found in default locations.');
+ foreach ($this->searchRoots as $root) {
+ Console::dim(' - ' . $root);
+ }
+ Console::line();
+ Console::note('Run "div templates " to search a specific directory.');
+ return 0;
+ }
+
+ Console::header('Available Templates');
+ Console::line();
+
+ foreach ($allTemplates as $template) {
+ $ext = $template['extension'] ?? 'tpl';
+ Console::segments([
+ ['text' => ' ' . str_pad($template['name'], 20), 'color' => Console::CYAN, 'bold' => true],
+ ['text' => '.', 'color' => Console::GRAY],
+ ['text' => $ext, 'color' => Console::YELLOW],
+ ['text' => ' ' . $template['path'], 'color' => Console::GRAY],
+ ]);
+ }
+
+ Console::line();
+ Console::note('Found ' . count($allTemplates) . ' template(s) in ' . count($foundLocations) . ' location(s)');
+
+ return 0;
+ }
+}
diff --git a/src/commands/VersionCommand.php b/src/commands/VersionCommand.php
new file mode 100644
index 0000000..deb8089
--- /dev/null
+++ b/src/commands/VersionCommand.php
@@ -0,0 +1,51 @@
+ 'div ', 'color' => Console::CYAN, 'bold' => true],
+ ['text' => 'v' . $this->app->getVersion(), 'color' => Console::YELLOW, 'bold' => true],
+ ]);
+ return 0;
+ }
+}
diff --git a/src/core/ArgParser.php b/src/core/ArgParser.php
new file mode 100644
index 0000000..882f6fc
--- /dev/null
+++ b/src/core/ArgParser.php
@@ -0,0 +1,99 @@
+parse($args);
+ }
+
+ private function parse(array $args): void
+ {
+ foreach ($args as $arg) {
+ if (str_starts_with($arg, '--')) {
+ $this->parseOption($arg);
+ } elseif (str_starts_with($arg, '-')) {
+ $this->flags[] = substr($arg, 1);
+ } else {
+ $this->positional[] = $arg;
+ }
+ }
+ }
+
+ private function parseOption(string $arg): void
+ {
+ $option = substr($arg, 2);
+
+ if (str_contains($option, '=')) {
+ [$key, $value] = explode('=', $option, 2);
+ $this->options[$key] = $value;
+ } else {
+ $this->options[$option] = true;
+ }
+ }
+
+ public function getOption(string $key, mixed $default = null): mixed
+ {
+ return $this->options[$key] ?? $default;
+ }
+
+ public function hasOption(string $key): bool
+ {
+ return isset($this->options[$key]);
+ }
+
+ public function hasFlag(string $flag): bool
+ {
+ return in_array($flag, $this->flags, true);
+ }
+
+ public function getPositional(int $index, mixed $default = null): mixed
+ {
+ return $this->positional[$index] ?? $default;
+ }
+
+ public function getPositionalAll(): array
+ {
+ return $this->positional;
+ }
+
+ public function getOptionOrArg(string $optionKey, int $positionalIndex, mixed $default = null): mixed
+ {
+ if ($this->hasOption($optionKey)) {
+ return $this->getOption($optionKey);
+ }
+ return $this->getPositional($positionalIndex, $default);
+ }
+}
diff --git a/src/core/Filesystem.php b/src/core/Filesystem.php
new file mode 100644
index 0000000..7adce33
--- /dev/null
+++ b/src/core/Filesystem.php
@@ -0,0 +1,180 @@
+isFile()) {
+ $ext = $file->getExtension();
+ if (in_array($ext, $extensions, true)) {
+ $relativePath = self::relativePath($rootPath, $file->getPathname());
+ $templates[] = [
+ 'path' => $relativePath,
+ 'full_path' => $file->getPathname(),
+ 'name' => $file->getBasename('.' . $ext),
+ 'extension' => $ext,
+ ];
+ }
+ }
+ }
+
+ return $templates;
+ }
+
+ public static function relativePath(string $from, string $to): string
+ {
+ $from = self::absolutePath($from);
+ $to = self::absolutePath($to);
+
+ $fromParts = explode(DIRECTORY_SEPARATOR, rtrim($from, DIRECTORY_SEPARATOR));
+ $toParts = explode(DIRECTORY_SEPARATOR, rtrim($to, DIRECTORY_SEPARATOR));
+
+ $commonLength = 0;
+ $minLength = min(count($fromParts), count($toParts));
+
+ for ($i = 0; $i < $minLength; $i++) {
+ if ($fromParts[$i] === $toParts[$i]) {
+ $commonLength++;
+ } else {
+ break;
+ }
+ }
+
+ $upCount = count($fromParts) - $commonLength;
+ $downParts = array_slice($toParts, $commonLength);
+
+ $relative = [];
+ for ($i = 0; $i < $upCount; $i++) {
+ $relative[] = '..';
+ }
+ $relative = array_merge($relative, $downParts);
+
+ return implode(DIRECTORY_SEPARATOR, $relative);
+ }
+
+ public static function canRead(string $path): bool
+ {
+ return is_readable($path);
+ }
+
+ public static function canWrite(string $path): bool
+ {
+ if (file_exists($path)) {
+ return is_writable($path);
+ }
+ $dir = dirname($path);
+ return is_dir($dir) && is_writable($dir);
+ }
+
+ public static function exists(string $path): bool
+ {
+ return file_exists($path);
+ }
+
+ public static function isFile(string $path): bool
+ {
+ return is_file($path);
+ }
+
+ public static function isDir(string $path): bool
+ {
+ return is_dir($path);
+ }
+}
diff --git a/src/core/InputParser.php b/src/core/InputParser.php
new file mode 100644
index 0000000..bb514e1
--- /dev/null
+++ b/src/core/InputParser.php
@@ -0,0 +1,374 @@
+ self::parseJson($input),
+ 'yaml', 'yml' => self::parseYaml($input),
+ 'xml' => self::parseXml($input),
+ 'php' => self::parsePhp($input),
+ default => throw new \InvalidArgumentException(
+ "Unsupported format: {$format}. Supported: " . implode(', ', self::SUPPORTED_FORMATS)
+ ),
+ };
+ }
+
+ public static function parseFile(string $filePath, ?string $format = null): array
+ {
+ if (!file_exists($filePath)) {
+ throw new \RuntimeException("Input file not found: {$filePath}");
+ }
+
+ $content = file_get_contents($filePath);
+
+ if ($format === null) {
+ $format = self::detectFormatFromPath($filePath);
+ }
+
+ return self::parse($content, $format);
+ }
+
+ private static ?string $stdinCache = null;
+
+ public static function hasStdinData(): bool
+ {
+ if (self::$stdinCache !== null) {
+ return self::$stdinCache !== '';
+ }
+
+ if (feof(STDIN)) {
+ self::$stdinCache = '';
+ return false;
+ }
+
+ $stat = fstat(STDIN);
+ if ($stat && ($stat['mode'] & 0170000) === 0 && $stat['size'] === 0) {
+ return false;
+ }
+
+ $content = fgets(STDIN);
+ if ($content === false) {
+ self::$stdinCache = '';
+ return false;
+ }
+
+ self::$stdinCache = $content;
+ return true;
+ }
+
+ public static function parseStdin(?string $format = null): array
+ {
+ if (self::$stdinCache !== null) {
+ $content = self::$stdinCache;
+ self::$stdinCache = null;
+ } else {
+ $content = '';
+ while (!feof(STDIN)) {
+ $chunk = fgets(STDIN);
+ if ($chunk === false) {
+ break;
+ }
+ $content .= $chunk;
+ }
+ }
+
+ if (trim($content) === '') {
+ throw new \RuntimeException("No data available on stdin");
+ }
+
+ if ($format === null) {
+ $format = self::detectFormat($content);
+ }
+
+ return self::parse($content, $format);
+ }
+
+ public static function supportedFormats(): array
+ {
+ return self::SUPPORTED_FORMATS;
+ }
+
+ private static function detectFormat(string $input): string
+ {
+ $input = trim($input);
+
+ if (str_starts_with($input, ' 'json',
+ 'yaml', 'yml' => 'yaml',
+ 'xml' => 'xml',
+ 'php' => 'php',
+ default => self::detectFormat(file_get_contents($path)),
+ };
+ }
+
+ private static function parseJson(string $input): array
+ {
+ $data = json_decode($input, true);
+
+ if (json_last_error() !== JSON_ERROR_NONE) {
+ throw new \RuntimeException("JSON parse error: " . json_last_error_msg());
+ }
+
+ return $data ?? [];
+ }
+
+ private static function parseYaml(string $input): array
+ {
+ if (!function_exists('yaml_parse')) {
+ if (!class_exists(\Symfony\Component\Yaml\Yaml::class)) {
+ return self::parseYamlSimple($input);
+ }
+ return \Symfony\Component\Yaml\Yaml::parse($input) ?? [];
+ }
+
+ $data = yaml_parse($input);
+
+ if ($data === false) {
+ return self::parseYamlSimple($input);
+ }
+
+ return $data;
+ }
+
+ private static function parseYamlSimple(string $input): array
+ {
+ $lines = explode("\n", $input);
+ $result = [];
+ $stack = [&$result];
+ $indentStack = [-1];
+
+ foreach ($lines as $line) {
+ if (trim($line) === '' || str_starts_with(trim($line), '#')) {
+ continue;
+ }
+
+ preg_match('/^(\s*)(.*)$/', $line, $matches);
+ $indent = strlen($matches[1]);
+ $content = trim($matches[2]);
+
+ while ($indent <= end($indentStack) && count($stack) > 1) {
+ array_pop($stack);
+ array_pop($indentStack);
+ }
+
+ if (str_contains($content, ':')) {
+ $colonPos = strpos($content, ':');
+ $key = trim(substr($content, 0, $colonPos));
+ $value = trim(substr($content, $colonPos + 1));
+
+ if ($value === '' || $value === '|' || $value === '>') {
+ $newArray = [];
+ $stack[count($stack) - 1][$key] = &$newArray;
+ $stack[] = &$newArray;
+ $indentStack[] = $indent;
+ } else {
+ $stack[count($stack) - 1][$key] = self::parseYamlValue($value);
+ }
+ } else {
+ $stack[count($stack) - 1][] = self::parseYamlValue($content);
+ }
+ }
+
+ return $result;
+ }
+
+ private static function parseYamlValue(string $value): mixed
+ {
+ $value = trim($value);
+
+ if ($value === 'true' || $value === 'false') {
+ return $value === 'true';
+ }
+
+ if ($value === 'null' || $value === '~') {
+ return null;
+ }
+
+ if (is_numeric($value)) {
+ return str_contains($value, '.') ? (float) $value : (int) $value;
+ }
+
+ if (preg_match('/^["\'](.*)["\']$/', $value, $matches)) {
+ return $matches[1];
+ }
+
+ if (preg_match('/^\[(.*)\]$/', $value, $matches)) {
+ $items = array_map('trim', explode(',', $matches[1]));
+ return array_map([self::class, 'parseYamlValue'], $items);
+ }
+
+ return $value;
+ }
+
+ private static function parseXml(string $input): array
+ {
+ $input = trim($input);
+
+ if (str_starts_with($input, '/', '', $input);
+ }
+
+ libxml_use_internal_errors(true);
+ $xml = simplexml_load_string($input);
+
+ if ($xml === false) {
+ $errors = libxml_get_errors();
+ libxml_clear_errors();
+ $errorMsg = !empty($errors) ? $errors[0]->message : 'Invalid XML';
+ throw new \RuntimeException("XML parse error: " . trim($errorMsg));
+ }
+
+ $rootName = $xml->getName();
+ $rootData = self::xmlToArray($xml);
+
+ if ($xml->count() === 0) {
+ return [$rootName => $rootData];
+ }
+
+ return [$rootName => $rootData];
+ }
+
+ private static function parsePhp(string $input): array
+ {
+ if (str_starts_with(trim($input), 'attributes() as $name => $value) {
+ $hasAttributes = true;
+ $attributes['@' . $name] = self::parseXmlText((string) $value);
+ }
+
+ if ($element->count() === 0) {
+ $text = (string) $element;
+ if ($text !== '') {
+ $result = self::parseXmlText($text);
+ }
+ if ($hasAttributes) {
+ $result = array_merge($attributes, is_array($result) ? $result : []);
+ }
+ return !empty($result) || $hasAttributes ? $result : null;
+ }
+
+ foreach ($element->children() as $child) {
+ $childName = $child->getName();
+ $childValue = self::xmlToArray($child);
+
+ if (isset($result[$childName])) {
+ if (!is_array($result[$childName]) || (isset($result[$childName][0]) && !is_array($result[$childName][0]))) {
+ $result[$childName] = [$result[$childName]];
+ }
+ if (is_array($childValue)) {
+ $result[$childName][] = $childValue;
+ }
+ } else {
+ $result[$childName] = $childValue;
+ }
+ }
+
+ if ($hasAttributes) {
+ $result = array_merge($attributes, $result);
+ }
+
+ return $result;
+ }
+
+ private static function parseXmlText(string $text): mixed
+ {
+ $text = trim($text);
+
+ if ($text === 'true') {
+ return true;
+ }
+ if ($text === 'false') {
+ return false;
+ }
+ if ($text === 'null') {
+ return null;
+ }
+ if (is_numeric($text)) {
+ return str_contains($text, '.') ? (float) $text : (int) $text;
+ }
+
+ return $text;
+ }
+}
diff --git a/src/core/TemplateRunner.php b/src/core/TemplateRunner.php
new file mode 100644
index 0000000..fa828c8
--- /dev/null
+++ b/src/core/TemplateRunner.php
@@ -0,0 +1,59 @@
+ self::GREEN,
+ 'fail', 'error', 'failed' => self::RED,
+ 'warn', 'warning' => self::YELLOW,
+ 'info' => self::CYAN,
+ default => self::WHITE,
+ };
+
+ self::segments([
+ ['text' => '[' . str_pad($status, 5) . ']', 'color' => $color, 'bold' => true],
+ ['text' => ' ' . $message],
+ ]);
+ }
+
+ public static function table(array $rows, array $headers = []): void
+ {
+ if (empty($rows) && empty($headers)) {
+ return;
+ }
+
+ $allRows = array_merge([$headers], $rows);
+ $widths = [];
+
+ foreach ($allRows as $row) {
+ foreach ($row as $col => $value) {
+ $len = strlen((string) $value);
+ $widths[$col] = max($widths[$col] ?? 0, $len);
+ }
+ }
+
+ $separator = '+';
+ foreach ($widths as $width) {
+ $separator .= str_repeat('-', $width + 2) . '+';
+ }
+
+ self::line($separator);
+
+ if (!empty($headers)) {
+ $cells = [];
+ foreach ($headers as $col => $header) {
+ $cells[] = ['text' => ' ' . str_pad($header, $widths[$col]) . ' ', 'color' => self::CYAN, 'bold' => true];
+ }
+ self::segments($cells);
+ self::line($separator);
+ }
+
+ foreach ($rows as $row) {
+ $cells = [];
+ foreach ($row as $col => $value) {
+ $cells[] = ['text' => ' ' . str_pad((string) $value, $widths[$col]) . ' '];
+ }
+ self::segments($cells);
+ }
+
+ self::line($separator);
+ }
+}
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
new file mode 100644
index 0000000..3b3be68
--- /dev/null
+++ b/tests/bootstrap.php
@@ -0,0 +1 @@
+