feat: add bats tests, docs (#139)

* fix(test): ensure bats file list uses xargs

* docs(readme): use yarn for testing instructions

* fix(test): ensure pipelines fail properly

* docs(alias): fix table header

---------

Signed-off-by: Ismo Vuorinen <ismo@ivuorinen.net>
This commit is contained in:
2025-06-30 04:30:06 +03:00
committed by GitHub
parent 1531647e01
commit cf7ca2109f
82 changed files with 1368 additions and 16 deletions

30
.github/AGENTS.md vendored Normal file
View File

@@ -0,0 +1,30 @@
# Guidelines for AI contributors
These instructions help language models work with this repository.
## Setup
1. Run `npm install` to get linting tools and the Bats test framework.
## Formatting
- Format code and docs with Prettier and markdownlint:
```bash
npm run fix:prettier
npm run fix:markdown
```
- Shell scripts should pass `shellcheck`.
## Testing
- When code changes, run `npm test` to execute Bats tests.
- If only comments or documentation change, tests may be skipped.
## Commits and PRs
- Use Semantic Commit messages: `type(scope): summary`.
- Keep PR titles in the same format.
<!-- vim: set ft=markdown spell spelllang=en_us cc=80 : -->

View File

@@ -60,7 +60,7 @@ representative at an online or offline event.
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
ismo@ivuorinen.net.
<ismo@ivuorinen.net>.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
@@ -116,7 +116,7 @@ the community.
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
<https://www.contributor-covenant.org/version/2/0/code_of_conduct.html>.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
@@ -124,5 +124,5 @@ enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
<https://www.contributor-covenant.org/faq>. Translations are available at
<https://www.contributor-covenant.org/translations>.

46
.github/README.md vendored
View File

@@ -43,6 +43,12 @@ see what interesting stuff you've done with it. Sharing is caring.
| `local/bin` | Helper scripts that I've collected or wrote. |
| `scripts` | Setup scripts. |
### Host specific configuration
Configurations under `hosts/<hostname>` are applied only when running on the
matching machine. Each host folder contains its own `install.conf.yaml` that
is processed by Dotbot during installation.
### dotfile folders
| Repo | Destination | Description |
@@ -58,6 +64,21 @@ see what interesting stuff you've done with it. Sharing is caring.
Running `dfm` gives you a list of available commands.
#### Documentation generation
`dfm docs` generates Markdown documentation under the `docs/` directory. The
subcommands are:
```bash
dfm docs alias # regenerate alias table
dfm docs folders # document interesting folders
dfm docs keybindings # update keybinding docs for tmux, nvim and others
dfm docs all # run every docs task
```
The `docs/` folder contains generated cheat sheets, keybindings and other
reference files. New documentation can be added without modifying this README.
## Configuration
The folder structure follows [XDG Base Directory Specification][xdg] where possible.
@@ -73,6 +94,31 @@ The folder structure follows [XDG Base Directory Specification][xdg] where possi
Please see [docs/folders.md][docs-folders] for more information.
## Managing submodules
This repository uses Git submodules for external dependencies. After cloning,
run:
```bash
git submodule update --init --recursive
```
To pull submodule updates later use:
```bash
git submodule update --remote --merge
```
The helper script `add-submodules.sh` documents how each submodule is added and
configured. Submodules are automatically updated by the
[update-submodules.yml](.github/workflows/update-submodules.yml) workflow.
## Testing
Shell scripts under `local/bin` are validated with [Bats](https://github.com/bats-core/bats-core).
Run `yarn test` to execute every test file. Bats is installed as a development
dependency, so run `yarn install` first if needed.
[dfm]: https://github.com/ivuorinen/dotfiles/blob/main/local/bin/dfm
[docs-folders]: https://github.com/ivuorinen/dotfiles/blob/main/docs/folders.md
[xdg]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html