feat(config): add directory-aware label scoping for monorepos (fixes #541)
Adds automatic label filtering based on current working directory:
- New config option: directory.labels (maps directory patterns to labels)
- bd ready and bd list auto-apply label filtering when in matching directory
- Uses --label-any semantics (shows issues with any of the matching labels)
Config example:
```yaml
directory:
labels:
packages/maverick: maverick
packages/agency: agency
```
When running `bd ready` from `packages/maverick/`, issues labeled
"maverick" are automatically shown first, without needing --label-any.
Closes #541
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/steveyegge/beads/internal/config"
|
||||
"github.com/steveyegge/beads/internal/rpc"
|
||||
"github.com/steveyegge/beads/internal/storage"
|
||||
"github.com/steveyegge/beads/internal/types"
|
||||
@@ -148,7 +149,14 @@ var listCmd = &cobra.Command{
|
||||
|
||||
// Normalize labels: trim, dedupe, remove empty
|
||||
labels = util.NormalizeLabels(labels)
|
||||
labelsAny = util.NormalizeLabels(labelsAny)
|
||||
labelsAny = util.NormalizeLabels(labelsAny)
|
||||
|
||||
// Apply directory-aware label scoping if no labels explicitly provided (GH#541)
|
||||
if len(labels) == 0 && len(labelsAny) == 0 {
|
||||
if dirLabels := config.GetDirectoryLabels(); len(dirLabels) > 0 {
|
||||
labelsAny = dirLabels
|
||||
}
|
||||
}
|
||||
|
||||
filter := types.IssueFilter{
|
||||
Limit: limit,
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/fatih/color"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/steveyegge/beads/internal/config"
|
||||
"github.com/steveyegge/beads/internal/rpc"
|
||||
"github.com/steveyegge/beads/internal/storage/sqlite"
|
||||
"github.com/steveyegge/beads/internal/types"
|
||||
@@ -27,6 +30,13 @@ var readyCmd = &cobra.Command{
|
||||
labels = util.NormalizeLabels(labels)
|
||||
labelsAny = util.NormalizeLabels(labelsAny)
|
||||
|
||||
// Apply directory-aware label scoping if no labels explicitly provided (GH#541)
|
||||
if len(labels) == 0 && len(labelsAny) == 0 {
|
||||
if dirLabels := config.GetDirectoryLabels(); len(dirLabels) > 0 {
|
||||
labelsAny = dirLabels
|
||||
}
|
||||
}
|
||||
|
||||
filter := types.WorkFilter{
|
||||
// Leave Status empty to get both 'open' and 'in_progress' (bd-165)
|
||||
Type: issueType,
|
||||
|
||||
Reference in New Issue
Block a user