Skip to content

Commit d7b01db

Browse files
authored
fix: always load archived beans, remove --with-archived flag (#33)
## Summary - Remove the `--with-archived` flag entirely - Always load beans from all subdirectories within `.beans/` - Archive becomes purely organizational (keeps `.beans/` tidy) rather than an access control mechanism ## Problem The `--with-archived` flag created a usability antipattern where users (or agents) needed prior knowledge about whether something was archived to find it. This led to surprising scenarios where searches would fail to find beans that existed but were archived. ## Solution 1. **Archived beans are always loaded** - No flag needed 2. **All subdirectories are now supported** - The loading mechanism now recursively finds all `.md` files within `.beans/`, preparing for future features like auto-filing beans into per-milestone or per-epic directories ## Changes ### Commit 1: Remove `--with-archived` flag - **cmd/root.go**: Removed `withArchived` variable and flag registration - **internal/beancore/core.go**: Removed `withArchived` field, `SetWithArchived()`, `WithArchived()` methods - **cmd/archive.go**: Updated description - **cmd/check.go**: Removed special handling that was enabling the flag ### Commit 2: Load beans from all subdirectories - **internal/beancore/core.go**: Replace `loadFromDisk` + `loadBeansFromDir` with `filepath.WalkDir` to recursively load all `.md` files - **internal/beancore/watcher.go**: Watch all subdirectories, not just root + archive - **internal/beancore/core_test.go**: Add `TestLoadFromSubdirectories` to document the new behavior - **cmd/prompt.tmpl**: Update agent instructions to remove `--with-archived` references ## Test plan - [x] All existing tests pass - [x] Build succeeds - [x] Verified `--with-archived` flag is no longer available - [x] Verified beans in nested subdirectories are loaded correctly - [x] New test documents loading from arbitrary subdirectory structures - [x] Agent prompt template updated
1 parent 3c0bd52 commit d7b01db

16 files changed

+397
-169
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
# beans-0ajg
3+
title: beans complete command
4+
status: todo
5+
type: task
6+
created_at: 2025-12-27T21:44:04Z
7+
updated_at: 2025-12-27T21:44:04Z
8+
parent: beans-mmyp
9+
---
10+
11+
Add `beans complete <id> [--summary <text>]` command.
12+
13+
## Behavior
14+
15+
- Sets status to `completed`
16+
- Optional `--summary` flag to add a completion note to the bean body
17+
- Shows confirmation message with bean title
18+
19+
## Example
20+
21+
```bash
22+
beans complete beans-abc --summary "Implemented via PR #42"
23+
```
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
# beans-18db
3+
title: beans milestones command
4+
status: todo
5+
type: task
6+
created_at: 2025-12-27T21:44:05Z
7+
updated_at: 2025-12-27T21:44:05Z
8+
parent: beans-mmyp
9+
---
10+
11+
Add `beans milestones` command to list planned milestones.
12+
13+
## Behavior
14+
15+
- Lists all beans with type `milestone`
16+
- Shows progress (e.g., "3/10 children completed")
17+
- Sorted by priority or a target date if we add that field
18+
- Excludes completed/scrapped milestones by default (`--all` to include)
19+
20+
## Example
21+
22+
```bash
23+
beans milestones
24+
# Lists active milestones with their progress
25+
```
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
# beans-7kb7
3+
title: beans blocked command
4+
status: todo
5+
type: task
6+
created_at: 2025-12-27T21:44:05Z
7+
updated_at: 2025-12-27T21:44:05Z
8+
parent: beans-mmyp
9+
---
10+
11+
Add `beans blocked` command to show beans that are currently blocked.
12+
13+
## Behavior
14+
15+
- Lists beans that have blockers (other beans blocking them)
16+
- Shows what is blocking each bean
17+
- Helps identify bottlenecks in the project
18+
19+
## Example
20+
21+
```bash
22+
beans blocked
23+
# Shows:
24+
# beans-abc: "Add auth" (blocked by beans-xyz: "Set up database")
25+
```
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
# beans-8q44
3+
title: beans ready command
4+
status: todo
5+
type: task
6+
created_at: 2025-12-27T21:44:04Z
7+
updated_at: 2025-12-27T21:44:04Z
8+
parent: beans-mmyp
9+
---
10+
11+
Add `beans ready` command to find beans that are ready to work on.
12+
13+
## Behavior
14+
15+
- Shows beans with actionable status (`todo`) that are not blocked
16+
- Sorted by priority (critical → high → normal → low → deferred)
17+
- Excludes `completed`, `scrapped`, `draft`, and `in-progress`
18+
- Supports `--json` output
19+
20+
## Example
21+
22+
```bash
23+
beans ready
24+
# Lists all beans ready to pick up
25+
```
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
# beans-jvkq
3+
title: beans start command
4+
status: todo
5+
type: task
6+
created_at: 2025-12-27T21:44:04Z
7+
updated_at: 2025-12-27T21:44:04Z
8+
parent: beans-mmyp
9+
---
10+
11+
Add `beans start <id>` command.
12+
13+
## Behavior
14+
15+
- Sets status to `in-progress`
16+
- Displays the bean details (like `beans show`) so you can see what you're working on
17+
- Could optionally check if another bean is already in-progress and warn
18+
19+
## Example
20+
21+
```bash
22+
beans start beans-abc
23+
# Sets to in-progress and shows the bean
24+
```
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
# beans-m364
3+
title: beans progress command
4+
status: todo
5+
type: task
6+
created_at: 2025-12-27T21:44:05Z
7+
updated_at: 2025-12-27T21:44:05Z
8+
parent: beans-mmyp
9+
---
10+
11+
Add `beans progress` command to show a summary of work status.
12+
13+
## Behavior
14+
15+
- Shows counts by status (e.g., "5 in-progress, 12 todo, 8 completed")
16+
- Could show a simple progress bar
17+
- Optional: filter by milestone/epic to see progress on specific initiatives
18+
19+
## Example
20+
21+
```bash
22+
beans progress
23+
# Output:
24+
# In Progress: 2
25+
# Todo: 15
26+
# Completed: 23
27+
# Scrapped: 3
28+
# ━━━━━━━━━━━━━━━━ 57% complete
29+
```
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
# beans-mmyp
3+
title: Workflow CLI commands
4+
status: todo
5+
type: epic
6+
created_at: 2025-12-27T21:43:38Z
7+
updated_at: 2025-12-27T21:43:38Z
8+
---
9+
10+
Add explicit workflow-style CLI commands that provide intuitive shortcuts for common operations. These commands wrap existing functionality with cleaner, more memorable interfaces.
11+
12+
## Rationale
13+
14+
Currently, users need to use `beans update <id> -s completed` to complete a bean. Workflow commands like `beans complete <id>` are more intuitive and can enforce best practices (like requiring a reason when scrapping).
15+
16+
## Proposed Commands
17+
18+
- `beans complete` - Complete a bean with optional summary
19+
- `beans scrap` - Scrap a bean with required reason
20+
- `beans start` - Start working on a bean
21+
- `beans ready` - Find beans ready to work on
22+
- `beans next` - Show the next bean to work on
23+
- `beans milestones` - List planned milestones
24+
- `beans blocked` - Show blocked beans
25+
- `beans progress` - Show work progress summary
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
# beans-p17z
3+
title: beans next command
4+
status: todo
5+
type: task
6+
created_at: 2025-12-27T21:44:04Z
7+
updated_at: 2025-12-27T21:44:04Z
8+
parent: beans-mmyp
9+
---
10+
11+
Add `beans next` command to show the single most important bean to work on.
12+
13+
## Behavior
14+
15+
- Returns the highest-priority `todo` bean that is not blocked
16+
- Shows full bean details (like `beans show`)
17+
- If nothing is ready, suggests checking `beans blocked` or `beans list`
18+
19+
## Example
20+
21+
```bash
22+
beans next
23+
# Shows the single most important bean to tackle
24+
```
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
# beans-r780
3+
title: beans scrap command
4+
status: todo
5+
type: task
6+
created_at: 2025-12-27T21:44:04Z
7+
updated_at: 2025-12-27T21:44:04Z
8+
parent: beans-mmyp
9+
---
10+
11+
Add `beans scrap <id> --reason <text>` command.
12+
13+
## Behavior
14+
15+
- Sets status to `scrapped`
16+
- **Required** `--reason` flag to document why the bean was scrapped
17+
- Adds a `## Reason for Scrapping` section to the bean body (preserves project memory)
18+
- Shows confirmation message
19+
20+
## Example
21+
22+
```bash
23+
beans scrap beans-abc --reason "Superseded by beans-xyz approach"
24+
```

cmd/archive.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ var archiveCmd = &cobra.Command{
1414
Use: "archive",
1515
Short: "Move completed/scrapped beans to the archive",
1616
Long: `Moves all beans with status "completed" or "scrapped" to the archive directory (.beans/archive/).
17-
Archived beans are preserved for project memory but excluded from normal queries.
18-
Use --with-archived flag on other commands to include archived beans.
17+
Archived beans are preserved for project memory and remain visible in all queries.
18+
The archive keeps the main .beans directory tidy while preserving project history.
1919
2020
Relationships (parent, blocking) are preserved in archived beans.`,
2121
RunE: func(cmd *cobra.Command, args []string) error {

0 commit comments

Comments
 (0)