{"id":27858609,"url":"https://github.com/phpdevcommunity/wf","last_synced_at":"2025-05-04T14:20:50.824Z","repository":{"id":269066922,"uuid":"906313046","full_name":"phpdevcommunity/wf","owner":"phpdevcommunity","description":"WF is a minimalist and procedural language designed to simplify the automation of common tasks, such as building, installing, or deploying applications.","archived":false,"fork":false,"pushed_at":"2025-03-20T08:02:49.000Z","size":27,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-20T09:21:48.924Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phpdevcommunity.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-20T16:08:24.000Z","updated_at":"2025-03-20T08:01:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"f50a85fa-ec13-4250-9adc-0358c18d6c59","html_url":"https://github.com/phpdevcommunity/wf","commit_stats":null,"previous_names":["phpdevcommunity/wf"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpdevcommunity%2Fwf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpdevcommunity%2Fwf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpdevcommunity%2Fwf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpdevcommunity%2Fwf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phpdevcommunity","download_url":"https://codeload.github.com/phpdevcommunity/wf/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252345376,"owners_count":21733101,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-04T14:20:50.170Z","updated_at":"2025-05-04T14:20:50.809Z","avatar_url":"https://github.com/phpdevcommunity.png","language":"Go","readme":"\r\n# WF - Workflow Automation\r\n\r\n**WF** is a minimalist and procedural language designed to simplify the automation of common tasks, such as building, installing, or deploying applications.\r\n\r\n\r\n## 📖 Documentation\r\n- [English](#english)\r\n- [Français](#français)\r\n\r\n## English\r\n\r\n\r\n**WF** is a minimalist and procedural language designed to simplify the automation of common tasks, such as building, installing, or deploying applications.\r\n\r\nThe `wf` binary is a command-line interface that automatically detects `.wf` files in the current directory. These files are structured into **sections**, containing sequentially organized commands to execute workflows efficiently and reproducibly.\r\n\r\nWith WF, you can centralize and standardize your automation processes while maintaining a clear and accessible syntax.\r\n\r\n---\r\n\r\n## Structure of a `.wf` File\r\n\r\nA `.wf` file is organized into **sections**, each corresponding to a specific step in your workflow. Each section contains a list of commands to execute in a precise order.\r\n\r\n### Basic Example\r\n```wf\r\n[section-name] # Comment: Description of the section\r\nSET VARIABLE=value\r\nrun command\r\n```\r\n\r\n---\r\n\r\n## Example of a `.wf` File\r\n\r\n### **Example 1: Deploying a Symfony Application**\r\n\r\n```wf\r\n[prepare-env] # Prepare environment variables and system clock\r\nSET SYMFONY_CONSOLE=php bin/console\r\nsync_time\r\necho \"Environment preparation complete\"\r\n\r\n[install-dependencies] # Install dependencies\r\nrun composer install --no-dev --optimize-autoloader\r\nrun ${SYMFONY_CONSOLE} doctrine:database:create --if-not-exists\r\nrun ${SYMFONY_CONSOLE} doctrine:migrations:migrate --no-interaction\r\necho \"Dependencies installed and database is up to date\"\r\n\r\n[build-assets] # Build and optimize assets\r\nrun npm install\r\nrun npm run build\r\nrun ${SYMFONY_CONSOLE} assets:install --symlink --relative\r\necho \"Assets built and installed\"\r\n\r\n[set-permissions] # Set required permissions\r\nset_permissions var/cache 775\r\nset_permissions var/log 775\r\necho \"Permissions set\"\r\n\r\n[deploy] # Full deployment workflow\r\nwf prepare-env\r\nwf install-dependencies\r\nwf build-assets\r\nwf set-permissions\r\nnotify_success \"Symfony application deployed successfully\"\r\n```\r\n\r\n### **Example 2: Deploying a Dockerized Application**\r\n\r\n```wf\r\n[prepare-docker] # Prepare Docker environment\r\nSET DOCKER_COMPOSE=docker compose\r\nsync_time\r\necho \"Docker environment prepared\"\r\n\r\n[build-containers] # Build Docker containers\r\nrun ${DOCKER_COMPOSE} build\r\necho \"Docker containers built\"\r\n\r\n[start-containers] # Start Docker containers\r\nrun ${DOCKER_COMPOSE} up -d\r\necho \"Docker containers started\"\r\n\r\n[cleanup] # Clean up old images\r\nrun ${DOCKER_COMPOSE} prune --force\r\necho \"Old Docker images removed\"\r\n\r\n[deploy] # Full deployment workflow\r\nwf prepare-docker\r\nwf build-containers\r\nwf start-containers\r\nwf cleanup\r\nnotify_success \"Dockerized application deployed successfully\"\r\n```\r\n\r\n---\r\n\r\n### **Key Features Across Examples**\r\n\r\n1. **Modularity with Sections:** Each section corresponds to a logical step in the deployment process.\r\n2. **Reusability:** Sections like `prepare-env` or `set-permissions` can be reused in different projects.\r\n3. **Notifications:** Use `notify_success` or other notifications to indicate the completion or status of deployments.\r\n4. **Environment Variables:** Variables like `SYMFONY_CONSOLE` or `DOCKER_COMPOSE` simplify command reuse.\r\n5. **Simplicity:** The examples remain procedural and straightforward, aligning with the philosophy of WF.\r\n\r\n---\r\n\r\n## Available Commands\r\n\r\n1. **`SET VARIABLE=value`**: Defines an environment variable to be used in commands.\r\n2. **`run command`**: Executes a system command or script.\r\n3. **`copy src dest`**: Copies a file or directory.\r\n4. **`sync_time`**: Synchronizes the system clock with a time server.\r\n5. **`set_permissions path mode`**: Changes the permissions of a file or directory.\r\n6. **`echo message`**: Prints a message to the standard output.\r\n7. **`exit`**: Immediately terminates the script execution with an exit code of `0`.\r\n8. **`touch file`**: Creates an empty file unless it already exists.\r\n9. **`mkdir folder`**: Creates a directory, including any missing parent directories.\r\n10. **`docker_compose command`**: Executes a `docker compose` or `docker-compose` command, depending on availability.\r\n11. **`wf workflow_name`**: Executes a workflow defined in the `.wf` file.\r\n12. **`notify message`**: Displays a generic notification.\r\n13. **`notify_success message`**: Displays a success notification.\r\n14. **`notify_error message`**: Displays an error notification.\r\n15. **`notify_warning message`**: Displays a warning notification.\r\n16. **`notify_info message`**: Displays an informational notification.\r\n\r\n---\r\n\r\n## **How Does WF Work?**\r\n\r\n1. **Scanning `.wf` Files**:  \r\n   - When executed, `wf` scans the current directory and identifies all files with the `.wf` extension.\r\n   - Each `.wf` file is read, and all defined **sections** are collected.\r\n\r\n2. **Structure of Sections**:  \r\n   - Each `.wf` file is divided into **sections** marked by a section header, such as `[section-name]`.\r\n   - Sections contain commands to be executed in order.\r\n\r\n3. **Executing a Section**:  \r\n   - Once all sections from the `.wf` files are loaded, you can execute a specific section using the command:  \r\n     ```bash\r\n     wf section-name\r\n     ```\r\n   - WF will then execute all commands defined in that section.\r\n\r\n---\r\n\r\n## **Example Usage**\r\n\r\n### Example `.wf` File\r\n```wf\r\n[docker-build] # Build Section: Build the application with Docker\r\nSET DOCKER_COMPOSE=docker compose exec -T app-gaia\r\nrun ${DOCKER_COMPOSE} ./wf build\r\n\r\n[build] # Build Section: Build the application\r\nsync_time\r\nrun php -v\r\nSET SYMFONY_CONSOLE=php bin/console\r\ncopy .env .env.local\r\nrun composer install --optimize-autoloader\r\nrun ${SYMFONY_CONSOLE} doctrine:migrations:migrate --no-interaction\r\n```\r\n\r\n### Available Commands in This Example\r\n\r\nWhen the `wf` binary is executed, the sections are detected and listed as available commands.\r\n\r\n#### Example of Available Commands:\r\n```bash\r\nNAME:\r\n   wf - A new CLI application\r\n\r\nUSAGE:\r\n   wf [global options] command [command options]\r\n\r\nCOMMANDS:\r\n   build         Build Section: Build the application\r\n   docker-build  Build Section: Build the application with Docker\r\n   help, h       Shows a list of commands or help for one command\r\n\r\nGLOBAL OPTIONS:\r\n   --help, -h  show help\r\n```\r\n\r\n---\r\n\r\n## **Executing a Section**\r\n\r\n1. **List Available Sections**  \r\n   To display all available sections in the `.wf` files in the current directory:\r\n   ```bash\r\n   wf --help\r\n   ```\r\n\r\n2. **Execute a Specific Section**  \r\n   To execute a specific section, simply use its name as a command:\r\n   ```bash\r\n   wf docker-build\r\n   ```\r\n   This will execute all commands defined in the `[docker-build]` section.\r\n\r\n---\r\n\r\n## **Advantages of WF**\r\n\r\n- **Simple to Use**: No need to configure a complex tool like Makefile; everything is centralized in `.wf` files.\r\n- **Modular**: Divide your workflows into multiple reusable sections.\r\n- **Flexible**: Easily add your own commands and variables.\r\n\r\nWith `wf`, you can efficiently automate your build, installation, or deployment tasks by unifying everything in a simple and readable tool.\r\n\r\n\r\n## License\r\n\r\nWF is licensed under the **GNU Affero General Public License v3.0 (AGPL-3.0)**.  \r\n\r\n### Key Terms:\r\n- You are free to use this tool in any project or environment, including commercial ones.\r\n- Any modifications or improvements to this software must be made public under the same license.\r\n- This tool cannot be integrated into proprietary software or systems without respecting the terms of this license.\r\n\r\nFor the full license text, see the LICENSE file.\r\n\r\n\r\n## Français\r\n\r\n**WF** est un langage minimaliste et procédural conçu pour simplifier l'automatisation des tâches courantes, telles que la construction, l'installation ou le déploiement d'applications.\r\n\r\nLe binaire `wf` est une interface en ligne de commande qui détecte automatiquement les fichiers `.wf` présents dans le répertoire courant. Ces fichiers sont structurés en **sections**, contenant des commandes organisées de manière séquentielle pour exécuter des workflows de manière efficace et reproductible.\r\n\r\nAvec WF, vous pouvez centraliser et standardiser vos processus d'automatisation tout en gardant une syntaxe claire et accessible.\r\n\r\n---\r\n\r\n## Structure d'un Fichier `.wf`\r\n\r\nUn fichier `.wf` est organisé en **sections**, chacune correspondant à une étape spécifique de votre workflow. Chaque section contient une liste de commandes à exécuter dans un ordre précis.\r\n\r\n### Exemple Basique\r\n```wf\r\n[section-name] # Commentaire : Description de la section\r\nSET VARIABLE=value\r\nrun command\r\n```\r\n\r\n\r\n## Exemple de fichier `.wf`\r\n\r\n### **Exemple 1 : Déploiement d'une application Symfony**\r\n\r\n```wf\r\n[prepare-env] # Préparation des variables d'environnement et de l'horloge système\r\nSET SYMFONY_CONSOLE=php bin/console\r\nsync_time\r\necho \"Préparation de l'environnement terminée\"\r\n\r\n[install-dependencies] # Installation des dépendances\r\nrun composer install --no-dev --optimize-autoloader\r\nrun ${SYMFONY_CONSOLE} doctrine:database:create --if-not-exists\r\nrun ${SYMFONY_CONSOLE} doctrine:migrations:migrate --no-interaction\r\necho \"Les dépendances sont installées et la base de données est à jour\"\r\n\r\n[build-assets] # Construction et optimisation des assets\r\nrun npm install\r\nrun npm run build\r\nrun ${SYMFONY_CONSOLE} assets:install --symlink --relative\r\necho \"Les assets ont été construits et installés\"\r\n\r\n[set-permissions] # Définition des permissions nécessaires\r\nset_permissions var/cache 775\r\nset_permissions var/log 775\r\necho \"Les permissions ont été configurées\"\r\n\r\n[deploy] # Workflow complet de déploiement\r\nwf prepare-env\r\nwf install-dependencies\r\nwf build-assets\r\nwf set-permissions\r\nnotify_success \"Application Symfony déployée avec succès\"\r\n```\r\n\r\n\r\n### **Exemple 2 : Déploiement d'une application Dockerisée**\r\n\r\n```wf\r\n[prepare-docker] # Préparation de l'environnement Docker\r\nSET DOCKER_COMPOSE=docker compose\r\nsync_time\r\necho \"Environnement Docker prêt\"\r\n\r\n[build-containers] # Construction des conteneurs Docker\r\nrun ${DOCKER_COMPOSE} build\r\necho \"Les conteneurs Docker ont été construits\"\r\n\r\n[start-containers] # Démarrage des conteneurs Docker\r\nrun ${DOCKER_COMPOSE} up -d\r\necho \"Les conteneurs Docker sont démarrés\"\r\n\r\n[cleanup] # Nettoyage des anciennes images\r\nrun ${DOCKER_COMPOSE} prune --force\r\necho \"Les anciennes images Docker ont été supprimées\"\r\n\r\n[deploy] # Workflow complet de déploiement\r\nwf prepare-docker\r\nwf build-containers\r\nwf start-containers\r\nwf cleanup\r\nnotify_success \"Application Dockerisée déployée avec succès\"\r\n```\r\n\r\n---\r\n\r\n### **Principales caractéristiques des exemples**\r\n\r\n1. **Modularité avec les sections :** Chaque section correspond à une étape logique du processus de déploiement.\r\n2. **Réutilisabilité :** Des sections comme `prepare-env` ou `set-permissions` peuvent être réutilisées dans différents projets.\r\n3. **Notifications :** Utilisez `notify_success` ou d'autres notifications pour indiquer l'état ou la réussite des déploiements.\r\n4. **Variables d'environnement :** Des variables comme `SYMFONY_CONSOLE` ou `DOCKER_COMPOSE` simplifient la réutilisation des commandes.\r\n5. **Simplicité :** Les exemples restent procéduraux et simples, respectant la philosophie de WF.\r\n\r\n## Commandes Disponibles\r\n\r\n1. **`SET VARIABLE=value`** : Définit une variable d'environnement utilisée dans les commandes.\r\n2. **`run command`** : Exécute une commande système ou un script.\r\n3. **`copy src dest`** : Copie un fichier ou répertoire.\r\n4. **`sync_time`** : Synchronise l'horloge système avec un serveur de temps.\r\n5. **`set_permissions path mode`** : Change les permissions d'un fichier ou répertoire.\r\n6. **`echo message`** : Affiche un message sur la sortie standard.\r\n7. **`exit`** : Termine immédiatement l'exécution du script avec un code de sortie `0`.\r\n8. **`touch file`** : Crée un fichier vide, sauf s'il existe déjà.\r\n9. **`mkdir folder`** : Crée un répertoire, y compris les parents inexistants.\r\n10. **`docker_compose command`** : Exécute une commande `docker compose` ou `docker-compose`, selon ce qui est disponible.\r\n11. **`wf workflow_name`** : Exécute un workflow défini dans le fichier `.wf`.\r\n12. **`notify message`** : Affiche une notification générique.\r\n13. **`notify_success message`** : Affiche une notification de succès.\r\n14. **`notify_error message`** : Affiche une notification d'erreur.\r\n15. **`notify_warning message`** : Affiche une notification d'avertissement.\r\n16. **`notify_info message`** : Affiche une notification d'information.\r\n\r\n\r\n## **Comment Fonctionne WF ?**\r\n\r\n1. **Recherche des Fichiers `.wf` :**  \r\n   - Lors de l’exécution, `wf` scanne le répertoire courant et identifie tous les fichiers avec l'extension `.wf`.\r\n   - Chaque fichier `.wf` est lu, et toutes les **sections** définies sont collectées.\r\n\r\n2. **Structure des Sections :**  \r\n   - Chaque fichier `.wf` est divisé en **sections** délimitées par un en-tête de section, comme `[section-name]`.\r\n   - Les sections contiennent des commandes à exécuter dans l'ordre.\r\n\r\n3. **Exécution d'une Section :**  \r\n   - Une fois que toutes les sections des fichiers `.wf` ont été chargées, vous pouvez exécuter une section spécifique en utilisant la commande :  \r\n     ```bash\r\n     wf section-name\r\n     ```\r\n   - WF exécute alors toutes les commandes définies dans cette section.\r\n\r\n---\r\n\r\n## **Exemple d'Utilisation**\r\n\r\n### Exemple de Fichier `.wf`\r\n```wf\r\n[docker-build] # Section Build : Build de l'application avec Docker\r\nSET DOCKER_COMPOSE=docker compose exec -T app-gaia\r\nrun ${DOCKER_COMPOSE} ./wf build\r\n\r\n[build] # Section Build : Build de l'application\r\nsync_time\r\nrun php -v\r\nSET SYMFONY_CONSOLE=php bin/console\r\ncopy .env .env.local\r\nrun composer install --optimize-autoloader\r\nrun ${SYMFONY_CONSOLE} doctrine:migrations:migrate --no-interaction\r\n```\r\n\r\n### Commandes Disponibles dans Cet Exemple\r\n\r\nLors de l'exécution du binaire `wf`, les sections sont détectées et listées comme des commandes disponibles.\r\n\r\n#### Exemple de Commandes Disponibles :\r\n```bash\r\nNAME:\r\n   wf - A new cli application\r\n\r\nUSAGE:\r\n   wf [global options] command [command options]\r\n\r\nCOMMANDS:\r\n   build         Section Build : Build de l'application\r\n   docker-build  Section Build : Build de l'application on Docker\r\n   help, h       Shows a list of commands or help for one command\r\n\r\nGLOBAL OPTIONS:\r\n   --help, -h  show help\r\n```\r\n\r\n---\r\n\r\n## **Exécution d'une Section**\r\n\r\n1. **Lister les Sections Disponibles**  \r\n   Pour afficher toutes les sections disponibles dans les fichiers `.wf` du répertoire courant :\r\n   ```bash\r\n   wf --help\r\n   ```\r\n\r\n2. **Exécuter une Section**  \r\n   Pour exécuter une section spécifique, utilisez simplement son nom comme commande :\r\n   ```bash\r\n   wf docker-build\r\n   ```\r\n   Cela exécutera toutes les commandes définies dans la section `[docker-build]`.\r\n\r\n\r\n## **Avantages de WF**\r\n\r\n- **Simple à Utiliser :** Pas besoin de configurer un outil complexe comme Makefile, tout est centralisé dans des fichiers `.wf`.\r\n- **Modulaire :** Divisez vos workflows en plusieurs sections réutilisables.\r\n- **Flexible :** Ajoutez facilement vos propres commandes et variables.\r\n\r\nAvec `wf`, vous pouvez automatiser efficacement vos tâches de build, d’installation, ou de déploiement en unifiant tout dans un outil simple et lisible.\r\n\r\n## Licence\r\n\r\nWF est distribué sous la **GNU Affero General Public License v3.0 (AGPL-3.0)**.\r\n\r\n### Principaux termes :\r\n- Vous êtes libre d'utiliser cet outil dans tout projet ou environnement, y compris des projets commerciaux.\r\n- Toute modification ou amélioration de ce logiciel doit être rendue publique sous la même licence.\r\n- Cet outil ne peut pas être intégré dans des logiciels ou systèmes propriétaires sans respecter les termes de cette licence.\r\n\r\nPour consulter le texte complet de la licence, veuillez vous référer au fichier LICENSE.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpdevcommunity%2Fwf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphpdevcommunity%2Fwf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpdevcommunity%2Fwf/lists"}