Commit Work
Commit all changes with the OpenSpec proposal title as the commit message and the change ID as a git trailer. Archives the change first if it is still active.
When to use
- The user wants to commit the current work with OpenSpec metadata attached.
- An active OpenSpec change exists and should be archived as part of committing.
- The user explicitly invokes
/commit-workor asks to "commit this change".
Steps
Determine OpenSpec ID and title:
- If arguments are provided, use them
- If you are currently working on an OpenSpec, use that ID and title
- Otherwise:
- Run
af changesto list active changes — it prints<title> (<id>) <completed>/<total> tasks, so it yields both the ID and the title in one call - If exactly one active change exists, use that ID and title
- If multiple changes exist, ask the user which one to use
- If no changes exist, ask the user for the ID and title
- If a change has no title in the listing, fall back to the first heading in
openspec/changes/<id>/proposal.md
- Run
Archive the OpenSpec change (if not already archived):
- Check if
openspec/changes/<id>/directory exists - If it exists, invoke
/opsx:archive <id> - If the directory does not exist (already archived), skip this step
- Check if
Run the following commands to stage all changes and create a commit with the OpenSpec ID as a git trailer:
git add -A git commit -m "<title>" --trailer "OpenSpec-Id=<openspec-id>"
Reference
- Run
git commit --helpfor commit options (see especially--trailer)