Skip to content

Conversation

@kyle-cassidy
Copy link
Contributor

@kyle-cassidy kyle-cassidy commented Jan 15, 2026

Summary

Allow users to override the config prefix at bean creation time. This enables patterns like:

beans create "My task" -t task --prefix "SYNC-TASK-"

Which generates IDs like SYNC-TASK-rbgr instead of using the default config prefix.

Motivation

The current static prefix (configured in .beans.yml) applies to all beans. This PR allows per-bean prefix customization, enabling use cases like:

  • Module-prefixed IDs: SYNC-TASK-xxxx, CLASS-EPIC-xxxx
  • Type-prefixed IDs: BUG-xxxx, FEAT-xxxx
  • Project-prefixed IDs: when working across multiple projects

Changes

  • Add prefix field to CreateBeanInput in GraphQL schema
  • Add --prefix flag to CLI create command
  • Pre-generate ID with custom prefix in resolver if provided
  • Add tests for custom prefix functionality

Testing

  • All existing tests pass
  • New tests cover: custom prefix, no prefix (uses config), empty prefix (uses config)
  • Manual testing: ./beans-dev create "Test" -t task --prefix "TEST-"TEST-xxxx

…───────────

     │ STDIN
─────┼──────────────────────────────────────────────────────────────────────────
   1 │ feat(cli): Add --prefix flag to create command
   2 │
   3 │ Allow users to override the config prefix at bean creation time.
   4 │ This enables patterns like:
   5 │
   6 │   beans create "My task" -t task --prefix "SYNC-TASK-"
   7 │
   8 │ Which generates IDs like `SYNC-TASK-rbgr` instead of using the
   9 │ default config prefix.
  10 │
  11 │ Changes:
  12 │ - Add `prefix` field to CreateBeanInput in GraphQL schema
  13 │ - Add `--prefix` flag to CLI create command
  14 │ - Pre-generate ID with custom prefix in resolver if provided
  15 │ - Add tests for custom prefix functionality
─────┴──────────────────────────────────────────────────────────────────────────
@hmans hmans self-assigned this Jan 15, 2026
@hmans
Copy link
Owner

hmans commented Jan 15, 2026

Very nice change, thanks for the PR!

@hmans hmans merged commit 726a3f2 into hmans:main Jan 15, 2026
1 check passed
hmans added a commit to divaltor/beans that referenced this pull request Jan 17, 2026
* origin/main:
  feat(tui): Two-column layout with detail preview (hmans#42)
  feat: add ETag support for optimistic concurrency control (hmans#59)
  feat(plugin): improve OpenCode plugin robustness with availability checks (hmans#58)
  feat(cli): Add --prefix flag to create command (hmans#56)
  chore: clean up README.md
  docs: only push prime if it exists (hmans#52)
  fix: normalise short IDs when storing relationship links (hmans#50)
@PrayagS
Copy link

PrayagS commented Jan 20, 2026

@hmans Can we consider adding the same flag to the init command as well? Currently I have to run init and then update the config file to update the default prefix. Will share a PR if this is accepted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants