Search by

rushphp / code-tool

stougeiro

RUSH code tool. Shared-host code delivery: check, push, promote, release and rollback.

Package info

github.com/rushphp/code-tool

pkg:composer/rushphp/code-tool

Statistics

Installs: 5

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.2.0 2026-11-24 02:03 UTC

This package is auto-updated.

Last update: 2026-11-24 02:09:07 UTC


README

English | PortuguΓͺs

PHP PHPStan-Level License

RUSH Code Tool

Shared-host code delivery for RUSH.

Pre-1.0: minor releases may include breaking changes.

πŸ“¦ Installation

composer require --dev rushphp/code-tool

This also installs the RUSH runtime (rushphp/rush) in the development context, so vendor/bin/rush is available.

Enable it in rush.json:

{
    "tools": {
        "code": true
    }
}

rush install creates the local .rush/code control layout even before code.layout.json exists. Deploy commands still require a valid layout.

🧱 Layout (required)

code.layout.json at the project root defines what is published and how. It contains no credentials and is separate from rush.json.

Shared-host note: the tool assumes a single SSH key per host. Operator and event records are an audit trail, not an authorization boundary; coordinate production deploys with your team.

{
  "php": { "min": "8.3" },
  "publish": [
    { "from": "application", "to": "$root/application" },
    { "from": "public", "to": "$webroot" }
  ],
  "env": [
    { "from": "application/env.json", "to": "$root/application/env.json" }
  ],
  "writable": ["$root/application/storage"],
  "exclude": ["application/storage", "application/env.json", "public/.maintenance"],
  "entrypoint": "public/index.php",
  "maintenance": { "type": "marker", "path": "$webroot/.maintenance" },
  "build": { "composer": true }
}
rush code layout:init                  # custom template
rush code layout:init --preset=slim    # installed/local preset
rush code layout:init --preset=slim --force
rush code layout:presets
rush code layout:validate

custom is built in. Other presets are installed as Composer packages declaring extra.rush.code.presets or placed in .rush/code/presets/.

Deploy state lives in .deploy: under root when the target has one, otherwise under webroot (protected). The tool owns releases, backups and events.

πŸš€ Commands

rush code check --target=staging
rush code push --target=staging
rush code promote --from=staging
rush code promote --from=development --to=production
rush code releases
rush code rollback --target=production

βš™οΈ Configuration

.rush/code/config.json

config.json holds global defaults and the development, staging and production targets. SSH auth files, local release mirrors, presets and overrides live under .rush/code/. The project layout is the separate, versioned code.layout.json.

.rush/code/
β”œβ”€β”€ config.json
β”œβ”€β”€ auth/
β”œβ”€β”€ stub/
β”œβ”€β”€ releases/
β”œβ”€β”€ events/
└── override/<target>/{application,public}

The whole .rush/ directory is local state and must not be committed.

🀝 Contributions

Contributions are welcome. Open an issue or submit a pull request.

πŸ“„ License

MIT. See LICENSE.