PHPackages                             shel/neos-terminal - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. shel/neos-terminal

ActiveNeos-plugin[CLI &amp; Console](/categories/cli)

shel/neos-terminal
==================

Neos CMS Ui terminal for running Eel expressions and other commands

2.0.1(2mo ago)1441.3k—3.1%8[3 issues](https://github.com/Sebobo/Shel.Neos.Terminal/issues)[1 PRs](https://github.com/Sebobo/Shel.Neos.Terminal/pulls)MITPHPPHP &gt;=8.2CI passing

Since Feb 9Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/Sebobo/Shel.Neos.Terminal)[ Packagist](https://packagist.org/packages/shel/neos-terminal)[ GitHub Sponsors](https://github.com/sebobo)[ Patreon](https://www.patreon.com/shelzle)[ RSS](/packages/shel-neos-terminal/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (33)Used By (0)

Neos CMS terminal for running Eel expressions and other commands in the UI
==========================================================================

[](#neos-cms-terminal-for-running-eel-expressions-and-other-commands-in-the-ui)

[![Tests](https://github.com/Sebobo/Shel.Neos.Terminal/actions/workflows/tests.yml/badge.svg)](https://github.com/Sebobo/Shel.Neos.Terminal/actions/workflows/tests.yml)

This package provides a Terminal emulator plugin for the [Neos CMS](https://www.neos.io) UI. Several commands are provided to save time during development &amp; debugging of Neos CMS projects.

All commands and their output are also automatically available in the browser dev console as `NeosTerminal` - for easier handling of JSON results and persistent history.

It uses the great [terminal component](https://github.com/linuswillner/react-console-emulator) by [Linus Willner](https://github.com/linuswillner).

**Quick overview:**

- Run commands via the Neos UI or in the browser console
    - Evaluate Eel expressions on the currently selected page &amp; content
    - Search for nodes by their properties
    - Flush caches
    - Repair nodes
- Autocompletion for command names
- Open Terminal via `t+t` shortcut
- Limit commands to backend roles
- Create your own commands and provide them in your own packages
- Full support for the [Shel.Neos.CommandBar](https://github.com/Sebobo/Shel.Neos.CommandBar)

How it looks
------------

[](#how-it-looks)

Watch the [video](https://vimeo.com/manage/videos/538570712)

[![Terminal example in the Neos CMS backend](Documentation/shel-neos-terminal-example.jpg)](Documentation/shel-neos-terminal-example.jpg)

Installation
------------

[](#installation)

Run the following command in your Neos project:

```
composer require shel/neos-terminal
```

### Supported Neos versions

[](#supported-neos-versions)

Due to required React features, the Terminal UI integration is only available for more recent Neos versions which provide React &gt;= 16.8. But the commands are still registered and available via the `NeosTerminal` global window object even when the React version is too old.

Neos versionTerminal4.3Commands are only available via the browser console5.2 - 5.3Full support7.0+Full support8.0+Full support9.0+Full supportUsage
-----

[](#usage)

There are three ways to access the terminal functionality:

1. Open the terminal by clicking on the terminal icon in the top menu bar in the Neos backend.
2. Open the terminal with the `t t` hotkey (configured via the Neos hotkey API in the `Settings.yaml`).
3. Access the terminal commands from the browser dev console via the global `NeosTerminal` object.

Now you can run any of the provided commands, or your own.

Included commands
-----------------

[](#included-commands)

Available default commands:

- `eel` - Eel expression parser
- `flushCache` - Flush one or all Neos/Flow caches
- `help` - Show command list and their arguments
- `clear` - Clear terminal
- `search` - Search for nodes by their properties
- `nodeRepair` - Repair nodes

You can add [custom commands](#adding-your-own-commands).

### Eel evaluator

[](#eel-evaluator)

The `eel` command allows you to run any Eel expression.

You can run simple expressions:

```
eel 5+2

```

Read a specific setting:

```
eel Configuration.setting('Neos.Flow.core.context')

```

Get a list of all Eel helpers:

```
eel Configuration.setting('Neos.Fusion.defaultContext')

```

Or more complex ones. The following call will return the labels of all subpages of your homepage:

```
eel Array.map(q(site).children().get(), page => page.label)

```

By default, the current `site`, `documentNode` and the currently selected `node` are available in your expression context.

*Note:* The command will run some conversions on the result:

- If the result is a node or a list of nodes, each node will be replaced with a list of their `properties`.
- Properties that are objects are replaced with their classname.

This will be optimised in future releases and should improve the readability of the output.

### Flush caches

[](#flush-caches)

The `flushCache` command allows you to flush all caches or a single cache.

E.g. the following call will flush the Fusion rendering cache:

```
flushCache Neos_Fusion_Content

```

If the cache identifier is omitted, all caches are flushed.

Please use this command only when absolutely necessary. Caching issues can be fixed in the implementation.

### Repair nodes

[](#repair-nodes)

The `nodeRepair` command allows you to repair nodes by their nodetype. It uses the same plugins and methods as the `./flow node:repair` CLI command.

E.g. the following call will remove undefined properties from the Neos example text nodes:

```
nodeRepair removeUndefinedProperties Neos.NodeTypes:Text

```

You can also do a dry run by adding the `-d` option and see what the method would do:

```
nodeRepair --dryRun removeUndefinedProperties Neos.NodeTypes:Text

```

To filter by workspace you can add the name of the workspace:

```
nodeRepair --workspace user-admin removeUndefinedProperties Neos.NodeTypes:Text

```

**Warning:** Some repair methods would ask you for confirmation when you run them via CLI. Currently they would execute without asking for confirmation.

Configuration
-------------

[](#configuration)

### Enabling the plugin in Production context

[](#enabling-the-plugin-in-production-context)

By default, the plugin is only loaded in *Development* context. If you want to have it active in *Production*, you have to override the setting in your `Settings.yaml`:

```
Neos:
  Neos:
    Ui:
      frontendConfiguration:
        'Shel.Neos.Terminal:Terminal':
          enabled: true
```

### Security

[](#security)

Executing commands in the Neos backend opens up a possible security risk.

Therefore, if you use this plugin in production, make sure only a limited number of users have access to it.

When creating your own commands, keep in mind to make sure nothing bad can happen to your database or other systems.

Example: If you have your own Eel helper that can send API requests to another system with full write access, this could be abused by someone if a backend user with enough privileges is hacked.

### Theming

[](#theming)

Have a look at the [Settings.yaml](Configuration/Settings.yaml) in this package and its `frontendConfiguration`. It allows you to override the theme with your own.

### Command policies

[](#command-policies)

By default, any *Administrator* has full access to all existing and added commands.

Additionally, the role `Shel.Neos.Terminal:TerminalUser` exists which by default can only run the `eel` command. You can add more privileges to this role to allow more commands and assign it to users or as a `parentRole` for other roles. See [Policy.yaml](Configuration/Policy.yaml) in this package for examples.

Adding your own commands
------------------------

[](#adding-your-own-commands)

Adding your commands takes just a few steps (depending on what you plan to do).

Create a new class named `MyCommand` and implement the `TerminalCommandControllerPluginInterface` from this package or inherit from `AbstractTerminalCommand`. As soon as you implemented all required methods, you are good to go!

As an example, you can create a command to show the joke of the day with the following class. Just adapt the namespace depending on your own package key.

```
