From 3650902d25a0b564e8a269cfc6cdeb23fa1dd48d Mon Sep 17 00:00:00 2001 From: yimin12 Date: Sat, 9 May 2026 02:05:48 -0400 Subject: [PATCH] Clarify commit normalizer task Nightshift-Task: commit-normalize Nightshift-Ref: https://github.com/marcus/nightshift --- internal/tasks/tasks.go | 2 +- internal/tasks/tasks_test.go | 37 ++++++++++++++++++++++++++++++++++ website/docs/task-reference.md | 2 +- 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/internal/tasks/tasks.go b/internal/tasks/tasks.go index 2c7dabb..a09523a 100644 --- a/internal/tasks/tasks.go +++ b/internal/tasks/tasks.go @@ -332,7 +332,7 @@ Apply safe updates directly, and leave concise follow-ups for anything uncertain Type: TaskCommitNormalize, Category: CategoryPR, Name: "Commit Message Normalizer", - Description: "Standardize commit message format", + Description: "Infer the repository's existing commit convention, then document or enforce it with lightweight repo-local configuration when appropriate. Avoid rewriting published history; only normalize recent local commit messages when it is safe.", CostTier: CostLow, RiskLevel: RiskLow, DefaultInterval: 24 * time.Hour, diff --git a/internal/tasks/tasks_test.go b/internal/tasks/tasks_test.go index 03cdf18..9cf8c4a 100644 --- a/internal/tasks/tasks_test.go +++ b/internal/tasks/tasks_test.go @@ -1,6 +1,7 @@ package tasks import ( + "strings" "testing" "time" ) @@ -243,6 +244,42 @@ func TestTaskDefinitionEstimatedTokens(t *testing.T) { } } +func TestCommitNormalizeDefinition(t *testing.T) { + def, err := GetDefinition(TaskCommitNormalize) + if err != nil { + t.Fatalf("GetDefinition(TaskCommitNormalize) error: %v", err) + } + + if def.Type != TaskCommitNormalize { + t.Errorf("Type = %q, want %q", def.Type, TaskCommitNormalize) + } + if def.Category != CategoryPR { + t.Errorf("Category = %d, want %d", def.Category, CategoryPR) + } + if def.CostTier != CostLow { + t.Errorf("CostTier = %d, want %d", def.CostTier, CostLow) + } + if def.RiskLevel != RiskLow { + t.Errorf("RiskLevel = %d, want %d", def.RiskLevel, RiskLow) + } + if def.DefaultInterval != 24*time.Hour { + t.Errorf("DefaultInterval = %v, want 24h", def.DefaultInterval) + } + + requiredText := []string{ + "existing commit convention", + "document or enforce", + "lightweight repo-local configuration", + "Avoid rewriting published history", + "only normalize recent local commit messages when it is safe", + } + for _, text := range requiredText { + if !strings.Contains(def.Description, text) { + t.Errorf("Description missing %q: %q", text, def.Description) + } + } +} + func TestRegistryCompleteness(t *testing.T) { // All task type constants should be in registry taskTypes := []TaskType{ diff --git a/website/docs/task-reference.md b/website/docs/task-reference.md index cb241df..6713707 100644 --- a/website/docs/task-reference.md +++ b/website/docs/task-reference.md @@ -23,7 +23,7 @@ Fully formed, review-ready artifacts. These tasks create branches and open pull | `backward-compat` | Backward-Compatibility Checks | Check and ensure backward compatibility | Medium | Low | 7d | | `build-optimize` | Build Time Optimization | Optimize build configuration for faster builds | High | Medium | 7d | | `docs-backfill` | Documentation Backfiller | Generate missing documentation | Low | Low | 7d | -| `commit-normalize` | Commit Message Normalizer | Standardize commit message format | Low | Low | 24h | +| `commit-normalize` | Commit Message Normalizer | Infer the repo's commit convention, document or lightly enforce it, and avoid unsafe history rewrites | Low | Low | 24h | | `changelog-synth` | Changelog Synthesizer | Generate changelog from commits | Low | Low | 7d | | `release-notes` | Release Note Drafter | Draft release notes from changes | Low | Low | 7d | | `adr-draft` | ADR Drafter | Draft Architecture Decision Records | Medium | Low | 7d |