Files
git.taskfile.build/library.md
T
2026-07-15 21:22:30 +02:00

630 lines
13 KiB
Markdown

---
layout: layouts/base.njk
---
# Library
In your task file import all commands from the taskfile library.
```bash
if [[ -d "$HOME/taskfile.build/bin" ]]; then
for file in "$HOME/taskfile.build/bin/"*; do
if [[ -f "$file" ]]; then
source "$file"
fi
done
fi
```
These commands create folder in the directory of the task file and the home directory. Here is an overview of these folders:
- `$PWD/tmp`: Temporary directory for the task commands.
- `$PWD/.prompt`: LLM prompts stored as markdown files.
- `$HOME/.config/taskfile.build`: Default path for storing dotenv files.
- `$HOME/.docker/$CONTAINER_REGISTRY`: Default path for storing container registry credentials.
## Aliases
Every command in the library has an alias derived from the first letters of each word. For example, `commit-with-llm` can also be invoked as `cwl`.
Aliases are appended to each script and pass through arguments:
```bash
cwl() {
commit-with-llm "$@"
}
```
If two commands would map to the same alias, the alias is extended with additional letters from the first conflicting word until it is unique. Aliases that would shadow standard shell commands (e.g. `cd`, `ls`, `cp`) are also extended to avoid collisions.
### Alias Map
| Command | Alias |
| --- | --- |
| `activate-venv` | `av` |
| `add-git-folder` | `agf` |
| `add-git-merge` | `agm` |
| `add-git-remote` | `agr` |
| `aggregate-git-folders` | `aggf` |
| `backup-env-files` | `bef` |
| `build-image` | `bi` |
| `checkout-git-folder` | `cgf` |
| `clean-git-folder` | `clgf` |
| `clone-git-folder` | `cgif` |
| `clone-taskfile` | `ct` |
| `commit-git-folder` | `cogf` |
| `commit-with-llm` | `cwl` |
| `copy-dotenv` | `cod` |
| `copy-to-clipboard` | `ctc` |
| `create-dotenv` | `crd` |
| `create-prompt` | `crp` |
| `create-symlink` | `cs` |
| `create-symlink-files` | `csf` |
| `download-git-folder` | `dgf` |
| `edit-dotenv` | `edd` |
| `ensure-directory` | `end` |
| `find-git-folder` | `fgf` |
| `generate-ssh-key` | `gsk` |
| `get-pass-from-keepass` | `gpfk` |
| `init-dotenv-dir` | `idd` |
| `init-project` | `inp` |
| `install-ansible-build-scripts` | `iabs` |
| `list-dotenv` | `lid` |
| `list-git-folder` | `lgf` |
| `list-prompts` | `lp` |
| `load-dotenv` | `lod` |
| `load-dotenv-from-keepass` | `ldfk` |
| `load-dotenv-from-pass` | `ldfp` |
| `load-kubeconfig-from-keepass` | `lkfk` |
| `load-kubeconfig-from-pass` | `lkfp` |
| `log-error` | `le` |
| `log-success` | `los` |
| `log-warning` | `lw` |
| `login-docker` | `ldo` |
| `ls-git-folder` | `lsgf` |
| `merge-git-remote` | `mgr` |
| `open-url-with-delay` | `ouwd` |
| `open-with-os` | `owo` |
| `pull-all-repos` | `par` |
| `pull-git-folder` | `pgf` |
| `push-git-folder` | `pugf` |
| `remove-dotenv` | `rd` |
| `remove-git-folder` | `rgf` |
| `remove-venv` | `rv` |
| `rename-dotenv` | `red` |
| `reset-git-folder` | `regf` |
| `restore-dotenv-files` | `rdf` |
| `run-pre-commit` | `rpc` |
| `save-dotenv-to-keepass` | `sdtk` |
| `save-dotenv-to-pass` | `sdtp` |
| `save-git-folder` | `sgf` |
| `save-kubeconfig-to-keepass` | `sktk` |
| `save-kubeconfig-to-pass` | `sktp` |
| `save-pass-to-keepass` | `sptk` |
| `show-dotenv` | `sd` |
| `show-dotenv-setup` | `sds` |
| `stage-git-folder` | `stgf` |
| `status-all-repos` | `sar` |
| `status-git-folder` | `sgif` |
| `switch-git-folder` | `swgf` |
| `sync-git-folder` | `sygf` |
| `template-dotenv` | `td` |
| `unshallow-git-folder` | `ugf` |
| `update-changelog-with-llm` | `ucwl` |
| `update-submodule` | `us` |
| `update-with-llm` | `uwl` |
## Task
Configure the task enviroment.
```bash
OPEN_BROWSER=False # Default: True
TASK_DOTENV_DIR="$HOME/Odoo-Build/config" # Default: "$HOME/.config/taskfile.build"
```
<!-- ===Task=== -->
### clone-taskfile
```bash
rows+=("clone-taskfile||Clone the taskfile.build repo.")
```
### init-project
```bash
rows+=("init-project||Setup a taskfile project in the current directory.")
```
### init-config-dir
```bash
rows+=("init-dotenv-dir||Setup task dotenv dir.")
```
### template-dotenv
```bash
rows+=("template-dotenv||Generate .env from .env.template.")
```
### open-with-os
```bash
rows+=("open-with-os||Open file or url with default application.")
```
### open-url-with-delay
```bash
rows+=("open-url-with-delay|[url][delay]|Open url after n seconds.")
```
### show-dotenv-setup
```bash
rows+=("show-dotenv-setup||Show info about the dotenv setup.")
```
### setup-completion
```bash
rows+=("setup-completion|[shell]|Show shell completion instructions.")
```
<!-- ===Task=== -->
## Files
Managing files and directories.
<!-- ===Files=== -->
### ensure-directory
```bash
rows+=("ensure-directory|[path]|Ensure directory path exists.")
```
### create-symlink
```bash
rows+=("create-symlink|[target][source]|Remove existing file/directory and create symlink.")
```
### create-symlink-files
```bash
rows+=("create-symlink-files|[target][source]|Create symlink for files in source pattern.")
```
<!-- ===Files=== -->
## Python
Setup Python virtual enviroment.
<!-- ===Python=== -->
### activate-venv
```bash
rows+=("activate-venv||Activate or initialize Python virtual env.")
```
### remove-venv
```bash
rows+=("remove-venv||Remove the Python virtual env.")
```
<!-- ===Python=== -->
## Environment
Manage `.env` files in the task config folder.
```bash
TASK_DOTENV_DIR="$HOME/Odoo-Build/config" # Default: "$HOME/.config/taskfile.build"
```
<!-- ===Enviroment=== -->
### create-dotenv
```bash
rows+=("create-dotenv|[env][type]|Create .env file of type nextcloud, odoo, upgrade.")
```
### list-dotenv
```bash
rows+=("list-dotenv||List dotenv files.")
```
### show-dotenv
```bash
rows+=("show-dotenv|[env]|Output content of the .env file.")
```
### copy-dotenv
```bash
rows+=("copy-dotenv|[env][env]|dotenv dotenv file.")
```
### edit-dotenv
```bash
rows+=("edit-dotenv|[env]|Open .env file in default editor.")
```
### load-dotenv
```bash
rows+=("load-dotenv|[env]|Load and export .env file.")
```
### rename-dotenv
```bash
rows+=("rename-dotenv|[env][env]|Rename .env file.")
```
### remove-dotenv
```bash
rows+=("remove-dotenv|[env]|Remove .env file.")
```
### backup-dotenv-files
```bash
rows+=("backup-dotenv-files|[path]|Archive and copy .env files to target location.")
```
### restore-dotenv-files
```bash
rows+=("restore-dotenv-files|[path]|Extract and copy .env files from backup file.")
```
<!-- ===Enviroment=== -->
## LLM
Commands that integrate the `llm` cli.
<!-- ===LLM=== -->
### commit-with-llm
```bash
rows+=("commit-with-llm||Commit with llm generated commit message.")
```
### update-with-llm
```bash
rows+=("update-with-llm|[glob][prompt]|Feed files matching glob to LLM and apply changes.")
```
The last parameter can be either a direct prompt string or a path to a text file containing the prompt.
### update-changelog-with-llm
```bash
rows+=("update-changelog-with-llm||Update CHANGELOG.md with changes from staged git diff using LLM.")
```
### create-prompt
```bash
rows+=("create-prompt|[path]|Create a new prompt file from template.")
```
### list-prompts
```bash
rows+=("list-prompts|[path]|List all prompt files.")
```
<!-- ===LLM=== -->
## Logging
Colorful logging in task commands.
<!-- ===Logging=== -->
### log-error
```bash
rows+=("log-error||Colored output for errors.")
```
### log-success
```bash
rows+=("log-success||Colored output for success.")
```
### log-warning
```bash
rows+=("log-warning||Colored output for warnings.")
```
<!-- ===Logging=== -->
## Git
These commands replace the `git submodule` command. The commands store and retrieve additional information from the `.gitmodules` file.
<!-- ===Git=== -->
### add-git-folder
```bash
rows+=("add-git-folder|[url][branch][path]|Add git folder to .gitmodules.")
```
### add-git-merge
```bash
rows+=("add-git-merge|[remote][merge][path]|Add git merge ref to git folder in .gitmodules.")
```
### add-git-remote
```bash
rows+=("add-git-remote|[remote][url][path]|Add git remote to git folder.")
```
### merge-git-remote
```bash
rows+=("merge-git-remote|[path]|Merge all remotes and refs defined in .gitmodules.")
```
### aggregate-git-folders
```bash
rows+=("aggregate-git-folders|[path]|Run gitaggregate for the repos.yaml.")
```
### aggregate-git-folders
```bash
rows+=("aggregate-git-folders|[path]|Run gitaggregate for the repos.yaml.")
```
### commit-git-folder
```bash
rows+=("commit-git-folder|[message][path]|Commit all changes of git folders from .gitmodules file.")
```
### clean-git-folder
```bash
rows+=("clean-git-folder|[path]|Clean git folder.")
```
### checkout-git-folder
```bash
rows+=("checkout-git-folder|[branch][path]|Checkout git commit from .gitmodules files.")
```
### clone-git-folder
```bash
rows+=("clone-git-folder|[path]|Clone git folder from .gitmodules file.")
```
### download-git-folder
```bash
rows+=("download-git-folder|[path]|Download git folder from .gitmodules file.")
```
### find-git-folder
```bash
rows+=("find-git-folder|[path]|Find all .git folders in path.")
```
### generate-ssh-key
```bash
rows+=("generate-ssh-key||Generate ssh key pair.")
```
### list-git-folder
```bash
rows+=("list-git-folder|[path]|List path and url of git folders from .gitmodules file.")
```
### ls-git-folder
```bash
rows+=("ls-git-folder|[path]|Space separated list of git folders from .gitmodules file.")
```
### pull-git-folder
```bash
rows+=("pull-git-folder|[branch][path]|Pull all git folders from .gitmodules file.")
```
### switch-git-folder
```bash
rows+=("switch-git-folder|[branch][path]|Switch branch for all git folders from .gitmodules file.")
```
### sync-git-folder
```bash
rows+=("sync-git-folder|[branch][path]|Switch, stash and pull all git folders from .gitmodules file.")
```
### push-git-folder
```bash
rows+=("push-git-folder|[path]|Push all git folders from .gitmodules file.")
```
### remove-git-folder
```bash
rows+=("remove-git-folder|[path]|Remove git folders in path from .gitmodules file.")
```
### reset-git-folder
```bash
rows+=("reset-git-folder|[path]|Abort, rebase and reset git folders from .gitmodules file.")
```
### run-pre-commit
```bash
rows+=("run-pre-commit|[path]|Run pre-commit in path.")
```
### stage-git-folder
```bash
rows+=("stage-git-folder|[path]|Stage all files in git folders from .gitmodules file.")
```
### status-git-folder
```bash
rows+=("status-git-folder|[path]|Show status of git folders from .gitmodules file.")
```
### save-git-folder
```bash
rows+=("save-git-folder||Save commit refs to .gitmodules.")
```
### update-submodule
```bash
rows+=("update-submodule||Update git submodules.")
```
<!-- ===Git=== -->
## Pass
Load and store secrets from pass.
The name of the entry will resolve dynamically depending on the current directory / project. Use `show-dotenv` to show info about the dotenv setup.
<!-- ===Pass=== -->
### save-dotenv-to-pass
```bash
rows+=("save-dotenv-to-pass|[file]|Store content of .env in pass entry.")
```
### load-dotenv-from-pass
```bash
rows+=("load-dotenv-from-pass|[file]|Restore content to .env from pass entry.")
```
<!-- ===Pass=== -->
## KeePass
Load and store secrets from KeePassXC.
Set path to KeePassXC database and entry:
```bash
KEEPASS_DATABASE_FILE="/path/to/database.kdbx"
KEEPASS_DATABASE_KEY_FILE="/path/to/keepass.key"
```
The name of the entry will resolve dynamically depending on the current directory / project. Use `show-dotenv` to show info about the dotenv setup.
<!-- ===KeePass=== -->
### save-pass-to-keepass
```bash
rows+=("save-pass-to-keepass|[pass][entry]|Store password to KeePass entry.")
```
### get-pass-from-keepass
```bash
rows+=("get-pass-from-keepass|[entry]|Get password from KeePass entry.")
```
### save-dotenv-to-keepass
```bash
rows+=("save-dotenv-to-keepass|[file]|Store content of .env in KeePass entry.")
```
### load-dotenv-from-keepass
```bash
rows+=("load-dotenv-from-keepass|[file]|Restore content to .env from KeePass entry.")
```
<!-- ===KeePass=== -->
## Kubernetes
Manage kube config files.
<!-- ===Kubernetes=== -->
### save-kubeconfig-to-pass
```bash
rows+=("save-kubeconfig-to-pass|[ctx]|Save kubeconfig file in pass.")
```
### save-kubeconfig-to-keepass
```bash
rows+=("save-kubeconfig-to-keepass|[ctx]|Save kubeconfig file in KeePass.")
```
### load-kubeconfig-from-pass
```bash
rows+=("load-kubeconfig-from-pass|[ctx]|Load kubeconfig file from pass.")
```
### load-kubeconfig-from-keepass
```bash
rows+=("load-kubeconfig-from-keepass|[ctx]|Load kubeconfig file from KeePass.")
```
<!-- ===Kubernetes=== -->
## Docker
Build and push Docker images.
Set Docker env vars.
```bash
BUILDX_PLATFORM="linux/amd64"
CONTAINER_REGISTRY="mintsystem"
CONTAINER_TAG="taskfile.build:latest"
DOCKERFILE="image/Dockerfile"
DOCKER_CONFIG="$HOME/.docker/$CONTAINER_REGISTRY/"
```
<!-- ===Docker=== -->
### login-docker
```bash
rows+=("login-docker|[user][token]|Run Docker login and create docker config.")
```
### build-image
```bash
rows+=("build-image|[output]|Build Docker image with buildx.")
```
<!-- ===Docker=== -->
## Ansible
Install scripts from the Ansible Build project.
The available roles with scripts are listed here: <https://ansible.build/scripts.html>
<!-- ===Docker=== -->
### install-ansible-build-scripts
```bash
rows+=("install-ansible-build-scripts|[role]|Install scripts of the specified Ansbile role.")
```
<!-- ===Docker=== -->