Skip to content

Add sort-yaml-key tool, reformat README as tools table - #11

Merged
skoonin merged 1 commit into
mainfrom
skoonin/add-sort-yaml-key-and-readme-table
Feb 18, 2026
Merged

skoonin merged 1 commit into
mainfrom
skoonin/add-sort-yaml-key-and-readme-table

Conversation

@skoonin

@skoonin skoonin commented Feb 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add sort-yaml-key tool with README (was missing from repo, only existed locally)
  • Reformat root README Tools section from categorized bullet list to a flat alphabetical table
  • Table columns: Tool (linked to README or directory), Description (up to 3 lines), Language, Version, Released

Test plan

  • All pre-commit hooks pass
  • Verify table renders correctly on GitHub
  • Verify all 26 tool links resolve
  • Tag sort-yaml-key/v1.0.0 after merge

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds the missing sort-yaml-key CLI tool to the repository and restructures the root README “Tools” section into a single alphabetical table to make discovery and linking more consistent.

Changes:

  • Added the sort-yaml-key Python CLI (plus its README) for sorting YAML lists by a specified key.
  • Reformatted the root README.md Tools section into a flat alphabetical table with metadata columns.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
sort-yaml-key/sort-yaml-key New CLI script that loads a YAML list, sorts items by a key, and emits reordered YAML.
sort-yaml-key/README.md Usage/options/docs for the new sort-yaml-key tool.
README.md Replaces categorized bullets with an alphabetical tools table and adds an entry for sort-yaml-key.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sort-yaml-key/sort-yaml-key Outdated
Comment on lines +27 to +31
# Parse the arguments
args = parser.parse_args()

# Load the YAML data from the file
with open(args.filename, "r") as file:

Copilot AI Feb 18, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script parses CLI args and executes file I/O at import time. Please wrap the CLI logic in a main() function and add an if __name__ == "__main__": main() guard (consistent with the other tools), so importing the module (or running static analysis) doesn’t unexpectedly run the command or call argparse.

Copilot uses AI. Check for mistakes.
Comment thread sort-yaml-key/sort-yaml-key Outdated
Comment on lines +31 to +35
with open(args.filename, "r") as file:
data = yaml.safe_load(file)

# Sort the data by the specified key
data.sort(key=lambda x: x[args.key])

Copilot AI Feb 18, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yaml.safe_load() can return None (empty file) or a non-list type, and data.sort(...)/x[args.key] will raise a runtime exception (AttributeError/TypeError/KeyError) with a traceback. Please validate that the input is a list of mappings and that the sort key exists in every item, and exit with a clear error message (non-zero) if not.

Copilot uses AI. Check for mistakes.
Comment thread sort-yaml-key/sort-yaml-key Outdated
Comment on lines +56 to +60
# Add the custom representer to the Dumper class
yaml.add_representer(OrderedDict, represent_ordereddict)

# Dump the sorted data
sorted_yaml = yaml.dump(data, default_flow_style=False)

Copilot AI Feb 18, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This uses yaml.dump() with a custom OrderedDict representer. Prefer yaml.safe_dump() to avoid the unsafe dumper, and pass sort_keys=False so key order is preserved without needing a global representer. One option is to avoid OrderedDict entirely by constructing a normal dict with the sort key inserted first, then safe_dump(..., sort_keys=False).

Copilot uses AI. Check for mistakes.
Comment thread README.md
| [`git-cleanup`](git-cleanup/) | Manage GitHub Actions runs and git branches.<br>Delete all workflow runs for a branch or delete local branches except main/master. | Python | v1.0.0 | 2026-02-18 |
| [`git-copy-branch`](git-copy-branch/) | Copy file changes between git branches.<br>Copies modified/added/deleted files from origin to destination branch.<br>Auto-commits deleted files. | Python | v1.0.0 | 2026-02-18 |
| [`git-force-quit-job`](git-force-quit-job/README.md) | Force-cancel a stuck GitHub Actions run.<br>Parses the run URL and issues a force-cancel via `gh api`. | Bash | v1.0.0 | 2026-02-18 |
| [`git-update-branches`](git-update-branches/) | Batch update git repositories.<br>Iterates through a directory of repos and updates the default branch.<br>Preserves state (stash, current branch) and restores after update. | Bash | v1.0.0 | 2026-02-18 |

Copilot AI Feb 18, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Tools table lists the command as git-update-branches, but the repo only contains git-update-branches/git-update-branches-in-dir (no git-update-branches/git-update-branches). This also means make link won’t discover/symlink it because the Makefile only links tools where the executable name matches the directory name. Please either rename/add a wrapper executable named git-update-branches, adjust the Makefile discovery logic, or update the README entry to match the actual command name.

Suggested change
| [`git-update-branches`](git-update-branches/) | Batch update git repositories.<br>Iterates through a directory of repos and updates the default branch.<br>Preserves state (stash, current branch) and restores after update. | Bash | v1.0.0 | 2026-02-18 |
| [`git-update-branches-in-dir`](git-update-branches/) | Batch update git repositories.<br>Iterates through a directory of repos and updates the default branch.<br>Preserves state (stash, current branch) and restores after update. | Bash | v1.0.0 | 2026-02-18 |

Copilot uses AI. Check for mistakes.
@skoonin
skoonin force-pushed the skoonin/add-sort-yaml-key-and-readme-table branch from 1c53721 to 275ba3b Compare February 18, 2026 21:34
@skoonin
skoonin force-pushed the skoonin/add-sort-yaml-key-and-readme-table branch from 275ba3b to 234cb2d Compare February 18, 2026 23:42
@skoonin
skoonin merged commit c363a3b into main Feb 18, 2026
3 checks passed
@skoonin
skoonin deleted the skoonin/add-sort-yaml-key-and-readme-table branch February 18, 2026 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants