Skip to content

Commit c2a374f

Browse files
nazrollgithub-actions[bot]Copilot
authored
Update docs (#12)
* Add documentation for the Trick object and update usage sections in README * Add initial documentation for wzrdbrain library * Add API reference and usage documentation for wzrdbrain library * Add disclaimer about AI coding assistant tools in contributors section * Add API reference for the Trick object and update links in documentation * Enhance contribution guidelines and credits section in documentation * Add documentation for generating trick combos in Python and JavaScript * Update credits section and add disclosure about AI coding assistant tools * Add documentation for the JavaScript translation process using translate2js.py * Refactor documentation for translate2js.py: improve clarity and consistency in section headings and descriptions * Add link to Python to JavaScript translation documentation and correct credits section * Refactor documentation: standardize headings and improve clarity in API reference and index files * Fix heading level for "Maintainers & contributors" section in index.md * Fix link in Table of contents for "Maintainers & contributors" section * Bump version to 0.1.6 and fix package-data syntax in pyproject.toml * Refactor documentation: standardize heading capitalization and improve clarity in CONTRIBUTING.md, GEMINI.md, README.md, and index.md * Update import paths in documentation for JavaScript usage and refine section headings for clarity * Update CI workflow and documentation for JavaScript output file renaming and path adjustments * Fix package_data syntax in pyproject.toml by removing duplicate entry * Add pyproject.toml to CI workflow path triggers * Move package_data definition under [tool.setuptools] section in pyproject.toml * chore: update src/wzrdbrain/wzrdbrain.js via utils/translate2js.py [skip ci] * delete: remove wzrdbrain.src.js file and its associated logic * docs: update README.md to clarify library usage and remove outdated examples * docs: refine credits section for clarity and remove duplicate entries * docs: update API reference and usage documentation for clarity and organization * docs: add table of contents to usage documentation for improved navigation * delete: remove CODE_OF_CONDUCT.md as it is no longer applicable * docs: add Contributor Covenant statement to contributing guidelines * docs: update Contributor Covenant link in contributing guidelines * bump version to 0.2 in pyproject.toml * chore: update src/wzrdbrain/wzrdbrain.js via utils/translate2js.py [skip ci] * docs: improve clarity in project description and usage of libraries * Update docs/usage.md * docs: update references to the generated JavaScript file name in documentation --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent c589243 commit c2a374f

File tree

11 files changed

+415
-116
lines changed

11 files changed

+415
-116
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ on:
77
push:
88
branches: ["**"]
99
paths:
10+
- 'utils/translate2js.py'
1011
- 'src/wzrdbrain/wzrdbrain.py'
1112
- 'src/wzrdbrain/tricks.json'
1213
- '.github/workflows/ci.yml'
14+
- 'pyproject.toml'
1315

1416
jobs:
1517
test:
@@ -59,21 +61,21 @@ jobs:
5961

6062
- name: Show first lines of generated file
6163
run: |
62-
echo "Preview of src/wzrdbrain/wzrdbrain.src.js:"
63-
head -n 60 src/wzrdbrain/wzrdbrain.src.js || true
64+
echo "Preview of src/wzrdbrain/wzrdbrain.js:"
65+
head -n 60 src/wzrdbrain/wzrdbrain.js || true
6466
- name: Detect changes in generated file
6567
id: diff
6668
shell: bash
6769
run: |
68-
# Determine if src/wzrdbrain/wzrdbrain.src.js is new or modified
69-
if git ls-files --error-unmatch src/wzrdbrain/wzrdbrain.src.js >/dev/null 2>&1; then
70-
if git diff --quiet -- src/wzrdbrain/wzrdbrain.src.js; then
70+
# Determine if src/wzrdbrain/wzrdbrain.js is new or modified
71+
if git ls-files --error-unmatch src/wzrdbrain/wzrdbrain.js >/dev/null 2>&1; then
72+
if git diff --quiet -- src/wzrdbrain/wzrdbrain.js; then
7173
echo "changed=false" >> "$GITHUB_OUTPUT"
7274
else
7375
echo "changed=true" >> "$GITHUB_OUTPUT"
7476
fi
7577
else
76-
if [ -f src/wzrdbrain/wzrdbrain.src.js ]; then
78+
if [ -f src/wzrdbrain/wzrdbrain.js ]; then
7779
echo "changed=true" >> "$GITHUB_OUTPUT"
7880
else
7981
echo "changed=false" >> "$GITHUB_OUTPUT"
@@ -84,7 +86,7 @@ jobs:
8486
uses: actions/upload-artifact@v4
8587
with:
8688
name: wzrdbrain-js
87-
path: src/wzrdbrain/wzrdbrain.src.js
89+
path: src/wzrdbrain/wzrdbrain.js
8890

8991
- name: Commit generated file to working branch
9092
if: steps.diff.outputs.changed == 'true'
@@ -93,6 +95,6 @@ jobs:
9395
git config user.name "github-actions[bot]"
9496
git config user.email "github-actions[bot]@users.noreply.github.com"
9597
git checkout -B "$branch"
96-
git add src/wzrdbrain/wzrdbrain.src.js
97-
git commit -m "chore: update src/wzrdbrain/wzrdbrain.src.js via utils/translate2js.py [skip ci]"
98+
git add src/wzrdbrain/wzrdbrain.js
99+
git commit -m "chore: update src/wzrdbrain/wzrdbrain.js via utils/translate2js.py [skip ci]"
98100
git push origin "$branch"

CODE_OF_CONDUCT.md

Lines changed: 0 additions & 4 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,25 @@
22

33
First off, thank you for considering contributing!
44

5-
## Submitting Changes
5+
This project follows the [Contributor Covenant](https://www.contributor-covenant.org/version/2/1/code_of_conduct/). By participating in this project, you agree to uphold this code.
6+
7+
## Submitting changes
68

79
1. Create a new branch for your feature or bug fix.
810
2. Make your changes and commit them.
911
3. Use clear, concise messages (e.g., feat: add X, fix: correct Y).
1012
4. Ensure all quality checks pass.
1113
5. Push your branch and open a pull request.
1214

13-
## Contributing a New Trick
15+
## Contributing a new move or trick
1416

1517
We welcome contributions of new tricks to the library! The list of tricks is managed in the `src/wzrdbrain/tricks.json` file.
1618

1719
To add a new trick, follow these steps:
1820

19-
1. **Open `src/wzrdbrain/tricks.json`**.
20-
2. **Add your trick to the `MOVES` list**. Please keep the list in alphabetical order.
21-
3. **Update the `RULES` if necessary**. If your trick has special properties, you may need to add it to one of the lists in the `RULES` section:
21+
1. Open `src/wzrdbrain/tricks.json`.
22+
2. Add your trick to the `MOVES` list. Please keep the list in alphabetical order.
23+
3. Update the `RULES` if necessary. If your trick has special properties, you may need to add it to one of the lists in the `RULES` section:
2224
* `ONLY_FIRST`: Moves that can only appear as the first trick in a combo.
2325
* `USE_FAKIE`: Moves that should be prefixed with "fakie" instead of "back".
2426
* `EXCLUDE_STANCE_BASE`: Moves that do not have a stance (e.g., "open", "closed").
@@ -28,7 +30,7 @@ After making your changes, be sure to run the test suite to ensure everything is
2830

2931
Once you have verified your changes, please see the "Submitting Changes" section for instructions on how to open a pull request.
3032

31-
## Development Setup
33+
## Development setup
3234

3335
To get started with development, follow these steps:
3436

@@ -50,11 +52,11 @@ To get started with development, follow these steps:
5052
pip install -e ".[dev]"
5153
```
5254

53-
## Running Quality Checks
55+
## Running quality checks
5456

5557
Before submitting a pull request, please ensure your code passes all quality checks.
5658

57-
### Linting and Formatting
59+
### Linting and formatting
5860

5961
We use `ruff` for linting and `black` for formatting.
6062

@@ -66,15 +68,15 @@ ruff check .
6668
black .
6769
```
6870

69-
### Type Checking
71+
### Type checking
7072

7173
We use `mypy` for static type checking.
7274

7375
```bash
7476
mypy .
7577
```
7678

77-
### Running Tests
79+
### Running tests
7880

7981
We use `pytest` for running unit tests.
8082

GEMINI.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Gemini Code Understanding
2+
3+
This document provides a summary of the `wzrdbrain` project, generated by Gemini.
4+
5+
## Project Summary
6+
7+
`wzrdbrain` is a Python library designed to generate random trick combinations for wizard skating. It can create sequences of tricks, ensuring that the transitions between them are logical. Users can also create individual tricks with specific attributes. The project also includes a JavaScript version of the library, which is automatically generated from the Python source code. The current version of the project is 0.1.6.
8+
9+
## Key Files
10+
11+
- **`pyproject.toml`**: The project's configuration file, defining metadata, dependencies, and development settings.
12+
- **`src/wzrdbrain/wzrdbrain.py`**: The core of the library, containing the logic for generating trick combinations in Python.
13+
- **`src/wzrdbrain/tricks.json`**: A JSON file that defines the available wizard skating tricks, including their names, stances, and transition rules.
14+
- **`tests/test_wzrdbrain.py`**: The test suite for the project, ensuring that the trick generation logic works as expected.
15+
- **`utils/translate2js.py`**: A utility script to translate the Python trick data and logic into a JavaScript-compatible format.
16+
- **`src/wzrdbrain/wzrdbrain.js`**: The generated JavaScript version of the library.
17+
- **`utils/wzrdbrain.base.js`**: A JavaScript file that contains the base logic for the JavaScript version of the library, used as a reference for the translation script.
18+
19+
## How to Use (Python)
20+
21+
As described in the `README.md`, you can use the `generate_combo` function to get a list of random tricks:
22+
23+
```python
24+
from wzrdbrain import generate_combo
25+
26+
# Generate a combo of 3 tricks
27+
combo = generate_combo(3)
28+
29+
# Get the names of the tricks
30+
trick_names = [trick['name'] for trick in combo]
31+
print(trick_names)
32+
```
33+
34+
## How to Use (JavaScript)
35+
36+
The generated JavaScript module can be used in any JavaScript environment that supports ES6 modules.
37+
38+
```javascript
39+
import { generateCombo } from 'https://cdn.jsdelivr.net/gh/nazroll/wzrdbrain/src/wzrdbrain/wzrdbrain.min.js';
40+
41+
// Generate a combo of 3 tricks
42+
const combo = generateCombo(3);
43+
44+
// Get the names of the tricks
45+
const trickNames = combo.map(trick => trick.name);
46+
console.log(trickNames);
47+
```
48+
49+
## Project Purpose
50+
51+
The main goal of this project is to provide a tool for wizard skaters to come up with new and creative trick combinations. By randomizing the sequence of tricks, it can help skaters break out of their usual patterns and discover new possibilities. The project also aims to provide a JavaScript version of the library for use in web-based applications.
52+
53+
## Recent Changes
54+
55+
The project has been recently updated to version 0.1.6. This update includes a fix for the `package_data` syntax in the `pyproject.toml` file, ensuring that the `tricks.json` file is correctly included in the package. There have also been a number of documentation updates to improve clarity and consistency.

README.md

Lines changed: 41 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,72 @@
11
# wzrdbrain
22

3-
A library to generate random trick combinations for wizard skating.
3+
A library to generate random trick combinations for wizard skating. This library is available in Python and JavaScript versions.
4+
5+
[Rocker'd Magic Moves](https://rockerd.web.app) - a trick generator app for wizard skating, is using both libraries.
6+
7+
The mobile web app is utilizing the JavaScript library version. It runs offline.
8+
9+
The [Rocker'd](https://rockerd.web.app) RESTFul API endpoints is using the Python library. Read the [API docs](https://rockerd.web.app/api/docs).
10+
11+
## Usage
12+
13+
### Python
414

5-
## Installation
615

716
```bash
817
pip install wzrdbrain
918
```
1019

11-
## Usage
12-
1320
The primary function is `generate_combo`, which returns a list of trick dictionaries. You can also create `Trick` objects directly for more control.
1421

1522
```python
1623
from wzrdbrain import generate_combo, Trick
1724

1825
# Generate a combo of 3 tricks
19-
combo = generate_combo(3)
20-
21-
# The output is a list of dictionaries, each representing a trick
22-
# print(combo)
23-
# Example output:
24-
# [
25-
# {
26-
# 'direction': 'front', 'stance': 'open', 'move': 'gazelle',
27-
# 'enter_into_trick': 'front', 'exit_from_trick': 'back',
28-
# 'name': 'front open gazelle'
29-
# },
30-
# {
31-
# 'direction': 'back', 'stance': None, 'move': '360',
32-
# 'enter_into_trick': 'back', 'exit_from_trick': 'back',
33-
# 'name': 'fakie 360'
34-
# },
35-
# # ... and so on
36-
# ]
37-
3826
# To get just the names of the tricks in the combo:
27+
combo = generate_combo(3)
3928
trick_names = [trick['name'] for trick in combo]
4029
print(trick_names)
4130
# Example output: ['front open gazelle', 'fakie 360', 'back open lion']
31+
#
4232
```
4333

44-
### Creating a Trick Object
45-
46-
You can create a `Trick` object with specific attributes. Any attributes not provided will be randomly generated.
34+
### JavaScript
4735

48-
```python
49-
# Create a trick with a specific move
50-
my_trick = Trick(move="lion s")
51-
52-
# Print the full trick object as a dictionary
53-
print(my_trick.to_dict())
54-
# Example output:
55-
# {
56-
# 'direction': 'back', 'stance': 'closed', 'move': 'lion s',
57-
# 'enter_into_trick': 'back', 'exit_from_trick': 'back',
58-
# 'name': 'back closed lion s'
59-
# }
36+
```
37+
https://cdn.jsdelivr.net/gh/nazroll/wzrdbrain/src/wzrdbrain/wzrdbrain.min.js
6038
```
6139

62-
## Development
40+
This library also provides a JavaScript version of the trick generation logic, which can be used in any environment that supports ES6 modules.
6341

64-
To contribute to this project, please see the [Contributing Guide](CONTRIBUTING.md).
42+
```javascript
43+
import { generateCombo } from 'https://cdn.jsdelivr.net/gh/nazroll/wzrdbrain/src/wzrdbrain/wzrdbrain.min.js';
6544

66-
First, clone the repository and install the project in editable mode with its development dependencies:
45+
// Generate a combo of 3 tricks
46+
const combo = generateCombo(3);
6747

68-
```bash
69-
git clone https://github.com/nazroll/wzrdbrain.git
70-
cd wzrdbrain
71-
pip install -e .[dev]
48+
// Get the names of the tricks
49+
const trickNames = combo.map(trick => trick.name);
50+
console.log(trickNames);
7251
```
7352

74-
You can run the test suite using `pytest`:
53+
For more examples, read the [usage documentation](./docs/usage.md).
7554

76-
```bash
77-
pytest
78-
```
55+
## Contribution
56+
57+
We welcome contributions! `wzrdbrain` is fully open source (Apache 2.0), and we encourage the community to:
58+
59+
- Submit a new move/trick into the database.
60+
- Report bugs and suggest features
61+
- Improve documentation
62+
- Submit code improvements
63+
64+
To contribute to this project, please read the [contributing guide](CONTRIBUTING.md).
65+
66+
## Credits
7967

80-
## List of wizard skating tricks
68+
Many thanks to the skaters and the wizard skating community for their valuable feedback and support. Special thanks to:
8169

82-
The list of tricks in this library is not comprehensive. Please create an issue and give us your suggestions of new tricks
70+
- Billy Arlew: for being a reliable source of inspiration and domain knowledge to the wizard tricks dictionary.
71+
- Eelco Soesman: for being a supportive Slightly Rockerd crew and early tester.
72+
- Bas Bavinck: for being the beacon of wizardry with his book and supporting this project.

docs/index.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Welcome to wzrdbrain
2+
3+
`wzrdbrain` is a library for generating random trick combinations for wizard skating. This documentation provides a guide for developers who want to use and contribute to the project.
4+
5+
## Table of contents
6+
7+
- [About the project](#about-the-project)
8+
- [Maintainers & contributors](#maintainers--contributors)
9+
- [Getting started](./usage.md)
10+
- [Python usage](./usage.md#python-usage)
11+
- [JavaScript usage](./usage.md#javascript-usage)
12+
- [API reference](usage.md#api-reference)
13+
- [The Trick object](./usage.md#the-trick-object)
14+
- [Generating trick combos](./usage.md#generating-trick-combos)
15+
- [Python-to-JS code translation](#python-to-js-code-translation)
16+
- [Credits](#credits)
17+
18+
19+
## About the project
20+
21+
`wzrdbrain` is designed to help wizard skaters discover new trick combinations. By randomizing the sequence of tricks, it can help skaters break out of their usual patterns.
22+
23+
The project provides both a Python and a JavaScript version of the library.
24+
25+
The JavaScript version is automatically generated from the Python source code using a translation script that leverages the Google Gemini API.
26+
27+
## Maintainers & contributors
28+
29+
[![contributors](https://contrib.rocks/image?repo=nazroll/wzrdbrain)](https://github.com/nazroll/wzrdbrain/graphs/contributors)
30+
31+
_**Disclosure:** AI coding assistant tools like Google Gemini CLI, Jules by Google and Github Copilot are used in this project._
32+
33+
## Getting started
34+
35+
For developers, read [usage.md](./usage.md) to learn how to install and use the library in Python and JavaScript.
36+
37+
## API reference
38+
39+
For more detailed information about the data structures used in `wzrdbrain`, please refer to the following documents:
40+
41+
- [The Trick object](./api_reference.md#the-trick-object)
42+
- [Generating trick combos](./api_reference.md#generating-trick-combos)
43+
44+
## Python-to-JS code translation
45+
46+
The JavaScript version of the library (`src/wzrdbrain/wzrdbrain.js`) is automatically generated from the Python source code. For more details on this process, read [Translating Python code to JavaScript code](./translate2js.md).
47+
48+
## Credits
49+
50+
Many thanks to the skaters and the wizard skating community for their valuable feedback and support. Special thanks to:
51+
52+
- Billy Arlew: for being a reliable source of inspiration and domain knowledge to the wizard tricks dictionary.
53+
- Eelco Soesman: for being a supportive Slightly Rockerd crew and early tester.
54+
- Bas Bavinck: for being the beacon of wizardry with his book and supporting this project.

0 commit comments

Comments
 (0)