Skip to content

Commit a2bd182

Browse files
Merge pull request #9 from desmondwong1215/update/exercise-utils
Update exercise-utils documentation
2 parents 806a1e3 + ab3a08e commit a2bd182

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

docs/exercises/exercise-utils.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,21 @@ They are loaded during exercise download, which means that the `app` has access
1313
## Available utility modules
1414

1515
- `exercise_utils.cli`: generic CLI calls
16+
- `exercise_utils.exercise_config`: helpers for updating `.gitmastery-exercise.json`, including adding PR metadata
1617
- `exercise_utils.file`: file creation and appending helpers
1718
- `exercise_utils.git`: common Git operations such as commit, repository initialization, and adding files
1819
- `exercise_utils.gitmastery`: Git-Mastery specific functions such as creating the start tag
19-
- `exercise_utils.github_cli`: GitHub CLI wrappers for forking, cloning, deleting, and creating repositories, as well as looking up the authenticated user
20+
- `exercise_utils.github_cli`: GitHub CLI wrappers for repository operations and pull request workflows such as creating, viewing, commenting on, reviewing, merging, and closing PRs
21+
- `exercise_utils.roles`: role-marker helpers for generating teammate-authored commits, merges, pull requests, comments, reviews, and PR closures
2022
- `exercise_utils.test`: testing utilities including `GitAutograderTestLoader` and `assert_output` for unit testing verification scripts
2123

24+
### `exercise_utils.roles`
25+
26+
`RoleMarker(role)` is useful when an exercise needs to simulate teammate-authored Git or GitHub activity while still using the normal helper APIs.
27+
28+
- It automatically prefixes commit messages, merge messages, PR titles and bodies, PR comments, and PR reviews with a `[ROLE:...]` marker
29+
- It also provides utilities for formatting, detecting, extracting, and stripping role markers when you need to work with the text directly
30+
2231
### `exercise_utils.cli` functions
2332

2433
The existing utility functions should cover most use cases, but if there is no existing utility function for your use case, `exercise_utils.cli` functions are available to execute other CLI calls. These should be used as a last resort.

0 commit comments

Comments
 (0)