baton-issue-tracker 1.13.0 → 1.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baton-issue-tracker",
3
- "version": "1.13.0",
3
+ "version": "1.13.2",
4
4
  "description": "A CLI issue tracker for AI agents",
5
5
  "type": "module",
6
6
  "bin": {
@@ -84,6 +84,21 @@ export function createIssue({
84
84
  } = {}) {
85
85
 
86
86
  const db = getDB();
87
+
88
+ // Normalize priority argument
89
+ if (priority !== undefined) {
90
+ const priorityValues = Object.values(Priority);
91
+ const match = priorityValues.find(v => v.toLowerCase() === priority.trim().toLowerCase());
92
+ priority = match || priority;
93
+ }
94
+
95
+ // Validate before inserting
96
+ const proposed = new Issue({ title, priority, tokenLimit, description, assigneeId });
97
+ const { isValid, errors } = proposed.validate();
98
+ if (!isValid) {
99
+ throw new Error(`Validation failed: ${errors.join(', ')}`);
100
+ }
101
+
87
102
  const result = db.insert(issuesTable)
88
103
  .values({
89
104
  title: title?.trim() || "PENDING",