feat(create): add require-description config option (GH#596)

Add create.require-description config option that enforces descriptions
when creating issues. When enabled, bd create will error if no
description is provided (except for test issues).

- Config in .beads/config.yaml or ~/.config/bd/config.yaml
- Also supports BD_CREATE_REQUIRE_DESCRIPTION env var
- Default: false (preserves current behavior with warning)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-20 02:38:00 -08:00
parent 8e8301a016
commit b4bc682d93
3 changed files with 20 additions and 6 deletions

View File

@@ -67,12 +67,18 @@ var createCmd = &cobra.Command{
// Get field values
description, _ := getDescriptionFlag(cmd)
// Warn if creating an issue without a description (unless it's a test issue or silent mode)
if description == "" && !strings.Contains(strings.ToLower(title), "test") && !silent && !debug.IsQuiet() {
yellow := color.New(color.FgYellow).SprintFunc()
fmt.Fprintf(os.Stderr, "%s Creating issue without description.\n", yellow("⚠"))
fmt.Fprintf(os.Stderr, " Issues without descriptions lack context for future work.\n")
fmt.Fprintf(os.Stderr, " Consider adding --description=\"Why this issue exists and what needs to be done\"\n")
// Check if description is required by config
if description == "" && !strings.Contains(strings.ToLower(title), "test") {
if config.GetBool("create.require-description") {
FatalError("description is required (set create.require-description: false in config.yaml to disable)")
}
// Warn if creating an issue without a description (unless silent mode)
if !silent && !debug.IsQuiet() {
yellow := color.New(color.FgYellow).SprintFunc()
fmt.Fprintf(os.Stderr, "%s Creating issue without description.\n", yellow("⚠"))
fmt.Fprintf(os.Stderr, " Issues without descriptions lack context for future work.\n")
fmt.Fprintf(os.Stderr, " Consider adding --description=\"Why this issue exists and what needs to be done\"\n")
}
}
design, _ := cmd.Flags().GetString("design")

View File

@@ -35,6 +35,7 @@ Tool-level settings you can configure:
| `no-auto-flush` | `--no-auto-flush` | `BD_NO_AUTO_FLUSH` | `false` | Disable auto JSONL export |
| `no-auto-import` | `--no-auto-import` | `BD_NO_AUTO_IMPORT` | `false` | Disable auto JSONL import |
| `no-push` | `--no-push` | `BD_NO_PUSH` | `false` | Skip pushing to remote in bd sync |
| `create.require-description` | - | `BD_CREATE_REQUIRE_DESCRIPTION` | `false` | Require description when creating issues |
| `db` | `--db` | `BD_DB` | (auto-discover) | Database path |
| `actor` | `--actor` | `BD_ACTOR` | `$USER` | Actor name for audit trail |
| `flush-debounce` | - | `BEADS_FLUSH_DEBOUNCE` | `5s` | Debounce time for auto-flush |
@@ -71,6 +72,10 @@ daemon-log-compress: true # Compress rotated logs (default true)
```yaml
# Project team prefers longer flush delay
flush-debounce: 15s
# Require descriptions on all issues (enforces context for future work)
create:
require-description: true
```
### Why Two Systems?

View File

@@ -109,6 +109,9 @@ func Initialize() error {
// Push configuration defaults
v.SetDefault("no-push", false)
// Create command defaults
v.SetDefault("create.require-description", false)
// Read config file if it was found
if configFileSet {
if err := v.ReadInConfig(); err != nil {