Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/monorepo-split-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ jobs:
- press
- product
- progress
- prompts
- publish
- record
- restore
Expand Down
5 changes: 5 additions & 0 deletions packages/devlink/config/devlink.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,11 @@
'path' => $public_base_path.'/progress',
'type' => 'public',
],
'prompts' => [
'active' => true,
'path' => $public_base_path.'/prompts',
'type' => 'public',
],
'record' => [
'active' => false,
'path' => $public_base_path.'/record',
Expand Down
3 changes: 3 additions & 0 deletions packages/prompts/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Changelog

We currently don't track changes in this package. Please refer to the [Moox Monorepo](https://github.com/mooxphp/moox) for the latest changes.
21 changes: 21 additions & 0 deletions packages/prompts/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) Moox <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
60 changes: 60 additions & 0 deletions packages/prompts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Moox Prompts

CLI-kompatible Prompts für Laravel Artisan Commands.

## Übersicht

Dieses Package bietet eine einfache Proxy-Implementierung für Laravel Prompts. Es ermöglicht es, die gleichen Helper-Funktionen wie Laravel Prompts zu verwenden, mit der Möglichkeit, später Web-Funktionalität hinzuzufügen.

## Features

- ✅ Alle Laravel Prompt-Typen unterstützt (`text`, `select`, `multiselect`, `confirm`, etc.)
- ✅ Identische API wie Laravel Prompts

## Installation

```bash
composer require moox/prompts
```

## Verwendung

### In Commands

Verwende die gleichen Helper-Funktionen wie in Laravel Prompts:

```php
use function Moox\Prompts\text;
use function Moox\Prompts\select;
use function Moox\Prompts\confirm;
use function Moox\Prompts\form;

public function handle()
{
// Einzelne Prompts
$name = text('What is your name?');
$package = select('Which package?', ['moox/core', 'moox/user']);
$confirm = confirm('Are you sure?');

// FormBuilder
$result = form()
->text('Name?')
->select('Package?', ['moox/core', 'moox/user'])
->submit();

// Command-Logik...
}
```

## Architektur

Das Package besteht aus:

- **PromptRuntime**: Interface für Prompt-Implementierungen
- **CliPromptRuntime**: CLI-Implementierung (delegiert an Laravel Prompts)
- **functions.php**: Globale Helper-Funktionen
- **PromptsServiceProvider**: Registriert Services

## License

Siehe [LICENSE.md](LICENSE.md)
5 changes: 5 additions & 0 deletions packages/prompts/ROADMAP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Roadmap

## Current tasks

- [ ] Create that package
13 changes: 13 additions & 0 deletions packages/prompts/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Security Policy

## Supported Versions

We maintain the current version of `Moox Prompts` actively.

Do not expect security fixes for older versions.

## Reporting a Vulnerability

If you find any security-related bug, please report it to [email protected].

Please do not use Github issues, to give us enough time to review and fix the issue, before others can use it, to do stupid things.
Binary file added packages/prompts/banner.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
107 changes: 107 additions & 0 deletions packages/prompts/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"name": "moox/prompts",
"description": "Prompts is a simple Moox Entity, that can be used to create and manage simple entries, like logs.",
"keywords": [
"Moox",
"Laravel",
"Filament",
"Moox package",
"Laravel package"
],
"homepage": "https://moox.org/docs/prompts",
"license": "MIT",
"authors": [
{
"name": "Moox Developer",
"email": "[email protected]",
"role": "Developer"
}
],
"require": {
"moox/core": "*"
},
"autoload": {
"psr-4": {
"Moox\\Prompts\\": "src",
"Moox\\Prompts\\Database\\Factories\\": "database/factories"
}
},
"autoload-dev": {
"psr-4": {
"Moox\\Prompts\\Tests\\": "tests/",
"Workbench\\App\\": "workbench/app/",
"Workbench\\Database\\Factories\\": "workbench/database/factories/",
"Workbench\\Database\\Seeders\\": "workbench/database/seeders/"
}
},
"extra": {
"laravel": {
"providers": [
"Moox\\Prompts\\PromptsServiceProvider"
]
},
"moox": {
"name": "Moox Prompts",
"stability": "stable",
"type": "moox-plugin",
"install": {
"auto_migrate": "database/migrations",
"auto_entities": {
"Prompts": true
},
"auto_class": {
"Prompts": "Moox\\Prompts\\Prompts"
},
"auto_run": {
"Run this": "php artisan run:this",
"Build the frontend": "npm run build",
"Clear the cache": "php artisan cache:clear"
},
"auto_runhere": {
"Build the frontend": "npm run build"
}
},
"update": {
"migrate": "database/migrations",
"merge": "moox-prompts-config"
},
"uninstall": {
"migrate": "database/migrations",
"remove": "moox-prompts-config"
}
}
},
"prefer-stable": true,
"require-dev": {
"moox/devtools": "^4.0",
"pestphp/pest-plugin-browser": "^4.0",
"pestphp/pest-plugin-livewire": "^4.0"
},
"config": {
"allow-plugins": {
"pestphp/pest-plugin": true
}
},
"scripts": {
"post-autoload-dump": [
"@clear",
"@prepare"
],
"clear": "@php vendor/bin/testbench package:purge-skeleton --ansi",
"prepare": "@php vendor/bin/testbench package:discover --ansi",
"build": "@php vendor/bin/testbench workbench:build --ansi",
"serve": [
"Composer\\Config::disableProcessTimeout",
"@build",
"@php vendor/bin/testbench serve --ansi"
],
"lint": [
"@php vendor/bin/pint --ansi",
"@php vendor/bin/phpstan analyse --verbose --ansi"
],
"test": [
"@clear",
"@php vendor/bin/pest"
]
}
}
56 changes: 56 additions & 0 deletions packages/prompts/config/prompts.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

/*
|--------------------------------------------------------------------------
| Moox Configuration
|--------------------------------------------------------------------------
|
| This configuration file uses translatable strings. If you want to
| translate the strings, you can do so in the language files
| published from moox_core. Example:
|
| 'trans//core::core.all',
| loads from common.php
| outputs 'All'
|
*/
return [

'readonly' => false,

'resources' => [
'item' => [
'single' => 'trans//item::item.item',
'plural' => 'trans//item::item.items',
'tabs' => [
'all' => [
'label' => 'trans//core::core.all',
'icon' => 'gmdi-filter-list',
'query' => [
[
'field' => 'title',
'operator' => '!=',
'value' => null,
],
],
],
],
],
],

'relations' => [],

/*
|--------------------------------------------------------------------------
| Navigation
|--------------------------------------------------------------------------
|
| The navigation group and sort of the Resource,
| and if the panel is enabled.
|
*/
'auth' => [
'user' => 'Moox\\DevTools\\Models\\TestUser',
],
'navigation_group' => 'DEV',
];
6 changes: 6 additions & 0 deletions packages/prompts/resources/lang/de/prompts.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

return [
'prompt' => 'Prompt',
'prompts' => 'Prompts',
];
6 changes: 6 additions & 0 deletions packages/prompts/resources/lang/en/prompts.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

return [
'prompt' => 'Prompt',
'prompts' => 'Prompts',
];
34 changes: 34 additions & 0 deletions packages/prompts/src/PromptsServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace Moox\Prompts;

use Moox\Core\MooxServiceProvider;
use Moox\Prompts\Support\CliPromptRuntime;
use Moox\Prompts\Support\PromptRuntime;
use Spatie\LaravelPackageTools\Package;

class PromptsServiceProvider extends MooxServiceProvider
{
public function configureMoox(Package $package): void
{
$package
->name('moox-prompts')
->hasConfigFile('prompts');
}

public function register()
{
parent::register();

$this->app->singleton(PromptRuntime::class, function ($app) {
return new CliPromptRuntime;
});
}

public function boot(): void
{
parent::boot();

require_once __DIR__.'/functions.php';
}
}
Loading
Loading