chore: add stderr.write lint rule and document repo standards gaps#906
Merged
chore: add stderr.write lint rule and document repo standards gaps#906
Conversation
Contributor
|
Contributor
Codecov Results 📊✅ 6660 passed | Total: 6660 | Pass Rate: 100% | Execution Time: 0ms 📊 Comparison with Base Branch
✨ No test changes detected All tests are passing successfully. ✅ Patch coverage is 100.00%. Project has 13517 uncovered lines. Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 76.61% 76.61% —%
==========================================
Files 303 303 —
Lines 57796 57794 -2
Branches 0 0 —
==========================================
+ Hits 44276 44277 +1
- Misses 13520 13517 -3
- Partials 0 0 —Generated by Codecov Action |
- New GritQL rule: no-stderr-write-in-commands.grit bans stderr.write() in command files (complements existing stdout.write rule). Commands should use logger.withTag() for warnings and diagnostics. - Fix one existing violation in issue/merge.ts (--into warning). - AGENTS.md: add sections for catch block logging, command file structure (~400 line threshold), new utility file checklist, and project filtering in API calls.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds automated enforcement and documentation for patterns that fell through existing checks during PR #904 review.
Changes
Automated Enforcement
no-stderr-write-in-commands.grit): Bansstderr.write()insrc/commands/**. Complements the existingno-stdout-write-in-commands.gritrule. Commands should uselogger.withTag()for warnings andlog.debug()for diagnostics.issue/merge.ts: The--intopreference warning now useslog.warn()instead ofthis.stderr.write().Documentation (AGENTS.md)
Four new sections addressing gaps identified during PR #904 review:
Catch Block Logging — Prohibits silent
catchblocks in production code. Every catch must re-throw, log withlog.debug()/log.warn(), or include a fallback with logging.Command File Structure — Commands should focus on arg parsing, API orchestration, and output dispatch. Extract formatting into
src/lib/formatters/<domain>.tswhen files exceed ~400 lines.Adding New Utility Files — Lookup table of existing shared modules to check before creating new utility files (duration formatting, hex ID validation, pagination, etc.). Prevents accidental duplication.
Project Filtering in API Calls — Documents that different API endpoints use different project filtering mechanisms (
buildProjectQueryvsprojectSlugsvsprojectparameter). Prevents double-filtering bugs.