Porffor follows a specific commit message style to keep the git history clean and informative.
Commit messages should follow this pattern:
Where:
${file} - The main file or area changed (without extension or path prefix)
${description} - Brief description of what changed
Examples
Built-in Implementations
builtins/date: impl toJSON
builtins/array: wip toReversed
builtins/tostring_number: impl radix
Bug Fixes
builtins/date: fix ToIntegerOrInfinity returning -0
builtins/string: fix trim not handling edge cases
Compiler Changes
codegen: fix inline wasm for unreachable
opt: improve constant folding
assemble: add support for custom sections
Prefixes by Area
Use these prefixes based on what you’re changing:
| Prefix | Use For | Example |
|---|
builtins/array | Array built-ins | builtins/array: add toSorted |
builtins/string | String built-ins | builtins/string: impl trimEnd |
builtins/date | Date built-ins | builtins/date: fix getTime |
builtins/number | Number built-ins | builtins/number: add toFixed |
builtins/math | Math built-ins | builtins/math: impl hypot |
builtins/object | Object built-ins | builtins/object: add freeze |
builtins/json | JSON built-ins | builtins/json: fix stringify |
builtins/* | Other built-ins | builtins/console: add debug |
codegen | Code generation | codegen: optimize loops |
opt | Optimizer | opt: add dead code elimination |
assemble | Wasm assembly | assemble: fix section ordering |
test262 | Test infrastructure | test262: add error tracking |
runtime | Runtime utilities | runtime: improve repl |
2c | Wasm to C compiler | 2c: optimize memory ops |
Description Guidelines
Keep It Concise
If possible, use short descriptions:
But don’t be afraid to use longer titles when needed:
builtins/string: fix toUpperCase not handling non-ASCII correctly
Use Imperative Mood
Write as if giving a command:
builtins/array: add filter method ✅
builtins/array: added filter method ❌
builtins/array: adds filter method ❌
Common Verbs
add / impl - New feature or method
fix - Bug fix
update - Enhancement to existing feature
optimize - Performance improvement
refactor - Code restructuring
remove - Deletion
wip - Work in progress
Multi-File Changes
If your change affects multiple files, use the primary file or area:
builtins/string: impl trim, trimStart, trimEnd
Or use the general area:
builtins: fix multiple type coercion issues
Commit Descriptions (Optional)
You can add detailed descriptions in the commit body:
builtins/array: impl toSorted
Implements Array.prototype.toSorted() which returns a new sorted array
without modifying the original. Uses the same sorting algorithm as sort()
but operates on a copy.
Test262: +47 passes in built-ins/Array/prototype/toSorted/
Bonus points for:
- Detailed explanations
- Test262 results
- Performance notes
Jokes in the description
Work in Progress
For incomplete features, use wip:
builtins/array: wip toReversed
This signals that the feature isn’t complete yet.
Git Workflow
One Commit Per Change
Ideally, have one commit per notable change. Use amend and force push to keep history clean:
# Make changes
git add .
git commit -m "builtins/string: impl trim"
# Oops, found an issue
# Fix it, then amend
git add .
git commit --amend --no-edit
# Force push (if you already pushed)
git push --force
Never force push to main/master unless explicitly requested and understood.
Multiple Commits
If you’re working on several independent features, separate commits are fine:
git commit -m "builtins/string: impl trim"
git commit -m "builtins/string: impl trimStart"
git commit -m "builtins/string: impl trimEnd"
What NOT to Include
Don’t include in your commits:
Generated Files
Don’t manually edit or commit:
compiler/builtins_precompiled.js (generated by precompile)
These are automatically generated.
Secrets
Never commit:
.env files
credentials.json
- API keys
- Passwords
If you accidentally commit secrets, ask for help immediately.
Real Examples from Porffor
Here are actual commits from Porffor’s history:
builtins/date: impl toJSON
Implemented a new method.
builtins/date: fix ToIntegerOrInfinity returning -0
Fixed a specific bug.
codegen: fix inline wasm for unreachable
Fixed a compiler issue.
builtins/array: wip toReversed
Work in progress on a feature.
builtins/tostring_number: impl radix
Implemented radix support for number to string conversion.
Before Submitting
Check Your Changes
# See what you changed
git status
git diff
# See recent commits for style examples
git log --oneline -10
Ensure Tests Pass
Run Test262 to verify your changes:
See Testing for details.
Review Your Commit
# View your commit
git show
# Check commit message
git log -1
Summary
Format: ${file}: ${description}
Examples:
builtins/array: add map
builtins/string: fix trim edge cases
codegen: optimize function calls
Tips:
- Keep it concise but clear
- Use imperative mood
- One commit per feature (use amend)
- Add detailed descriptions in commit body
- Don’t commit generated files or secrets
Next Steps