@proletariat/cli 0.3.30 → 0.3.32

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.
Files changed (39) hide show
  1. package/dist/commands/diet.d.ts +20 -0
  2. package/dist/commands/diet.js +181 -0
  3. package/dist/commands/mcp-server.js +2 -1
  4. package/dist/commands/priority/add.d.ts +15 -0
  5. package/dist/commands/priority/add.js +70 -0
  6. package/dist/commands/priority/list.d.ts +10 -0
  7. package/dist/commands/priority/list.js +34 -0
  8. package/dist/commands/priority/remove.d.ts +13 -0
  9. package/dist/commands/priority/remove.js +54 -0
  10. package/dist/commands/priority/set.d.ts +14 -0
  11. package/dist/commands/priority/set.js +60 -0
  12. package/dist/commands/pull.d.ts +23 -0
  13. package/dist/commands/pull.js +219 -0
  14. package/dist/commands/roadmap/generate.js +10 -5
  15. package/dist/commands/template/apply.js +5 -4
  16. package/dist/commands/template/create.js +9 -5
  17. package/dist/commands/ticket/create.js +6 -5
  18. package/dist/commands/ticket/edit.js +9 -9
  19. package/dist/commands/ticket/list.d.ts +2 -0
  20. package/dist/commands/ticket/list.js +20 -13
  21. package/dist/commands/ticket/update.js +8 -5
  22. package/dist/commands/work/spawn.d.ts +13 -0
  23. package/dist/commands/work/spawn.js +388 -1
  24. package/dist/lib/mcp/tools/diet.d.ts +6 -0
  25. package/dist/lib/mcp/tools/diet.js +261 -0
  26. package/dist/lib/mcp/tools/index.d.ts +1 -0
  27. package/dist/lib/mcp/tools/index.js +1 -0
  28. package/dist/lib/mcp/tools/template.js +1 -1
  29. package/dist/lib/mcp/tools/ticket.js +48 -3
  30. package/dist/lib/pmo/diet.d.ts +102 -0
  31. package/dist/lib/pmo/diet.js +127 -0
  32. package/dist/lib/pmo/storage/base.d.ts +5 -0
  33. package/dist/lib/pmo/storage/base.js +47 -0
  34. package/dist/lib/pmo/types.d.ts +12 -6
  35. package/dist/lib/pmo/types.js +6 -2
  36. package/dist/lib/pmo/utils.d.ts +40 -0
  37. package/dist/lib/pmo/utils.js +76 -0
  38. package/oclif.manifest.json +2872 -2534
  39. package/package.json +1 -1
@@ -59,17 +59,23 @@ export interface Epic {
59
59
  */
60
60
  export type TicketStatus = string;
61
61
  /**
62
- * Standardized priority values: P0 (critical) through P3 (low).
62
+ * Priority is now a string to support user-defined priority scales.
63
+ * The workspace's priority scale is stored in pmo_settings.
64
+ * Use getWorkspacePriorities() from utils.ts to get the current scale.
63
65
  */
64
- export type Priority = 'P0' | 'P1' | 'P2' | 'P3';
66
+ export type Priority = string;
65
67
  /**
66
- * Valid priority values as a const array for validation and CLI options.
68
+ * Default priority values as a const array.
69
+ * @deprecated Use getWorkspacePriorities() from utils.ts instead for runtime priority resolution.
70
+ * This constant is kept for backwards compatibility and as the default when no workspace scale is set.
67
71
  */
68
- export declare const PRIORITIES: readonly Priority[];
72
+ export declare const PRIORITIES: readonly string[];
69
73
  /**
70
- * Priority display names for UI presentation.
74
+ * Default priority display names for UI presentation.
75
+ * @deprecated Priority labels are derived from the workspace priority scale.
76
+ * For user-defined priorities, the label IS the priority value.
71
77
  */
72
- export declare const PRIORITY_LABELS: Record<Priority, string>;
78
+ export declare const PRIORITY_LABELS: Record<string, string>;
73
79
  /**
74
80
  * Legacy priority values for backwards compatibility.
75
81
  */
@@ -12,11 +12,15 @@
12
12
  * - Subtask - Smallest actionable piece
13
13
  */
14
14
  /**
15
- * Valid priority values as a const array for validation and CLI options.
15
+ * Default priority values as a const array.
16
+ * @deprecated Use getWorkspacePriorities() from utils.ts instead for runtime priority resolution.
17
+ * This constant is kept for backwards compatibility and as the default when no workspace scale is set.
16
18
  */
17
19
  export const PRIORITIES = ['P0', 'P1', 'P2', 'P3'];
18
20
  /**
19
- * Priority display names for UI presentation.
21
+ * Default priority display names for UI presentation.
22
+ * @deprecated Priority labels are derived from the workspace priority scale.
23
+ * For user-defined priorities, the label IS the priority value.
20
24
  */
21
25
  export const PRIORITY_LABELS = {
22
26
  P0: 'P0 - Critical',
@@ -123,4 +123,44 @@ export declare function findColumnByName(columnNames: string[], targetColumn: st
123
123
  * Check if two arrays have the same elements (order-independent)
124
124
  */
125
125
  export declare function arraysEqual<T>(a: T[], b: T[]): boolean;
126
+ /**
127
+ * Default priority scale (backwards compatible with hardcoded P0-P3).
128
+ */
129
+ export declare const DEFAULT_PRIORITIES: readonly ["P0", "P1", "P2", "P3"];
130
+ /**
131
+ * Get the workspace priority scale from pmo_settings.
132
+ * Returns the user-defined priority scale, or DEFAULT_PRIORITIES if not set.
133
+ *
134
+ * Priority values are ordered strings - position in array determines sort order.
135
+ * Index 0 is highest priority.
136
+ *
137
+ * @param db - Database instance
138
+ * @returns Array of priority strings ordered from highest to lowest
139
+ */
140
+ export declare function getWorkspacePriorities(db: DatabaseLike): string[];
141
+ /**
142
+ * Set the workspace priority scale in pmo_settings.
143
+ *
144
+ * @param db - Database instance
145
+ * @param priorities - Array of priority strings ordered from highest to lowest
146
+ */
147
+ export declare function setWorkspacePriorities(db: DatabaseLike, priorities: string[]): void;
148
+ /**
149
+ * Check if a value is a valid priority for the workspace.
150
+ *
151
+ * @param db - Database instance
152
+ * @param value - Value to check
153
+ * @returns true if the value is in the workspace priority scale
154
+ */
155
+ export declare function isValidWorkspacePriority(db: DatabaseLike, value: string): boolean;
156
+ /**
157
+ * Get the sort index for a priority value.
158
+ * Returns the position in the priority array (0 = highest priority).
159
+ * Returns Infinity for unknown priorities (sorts last).
160
+ *
161
+ * @param db - Database instance
162
+ * @param value - Priority value
163
+ * @returns Sort index (lower = higher priority)
164
+ */
165
+ export declare function getPrioritySortIndex(db: DatabaseLike, value: string | undefined | null): number;
126
166
  export {};
@@ -195,3 +195,79 @@ export function arraysEqual(a, b) {
195
195
  const sortedB = [...b].sort();
196
196
  return sortedA.every((val, idx) => val === sortedB[idx]);
197
197
  }
198
+ // =============================================================================
199
+ // Workspace Priority Settings
200
+ // =============================================================================
201
+ /**
202
+ * Default priority scale (backwards compatible with hardcoded P0-P3).
203
+ */
204
+ export const DEFAULT_PRIORITIES = ['P0', 'P1', 'P2', 'P3'];
205
+ /**
206
+ * Settings key for storing workspace priorities.
207
+ */
208
+ const PRIORITIES_SETTING_KEY = 'priorities';
209
+ /**
210
+ * Get the workspace priority scale from pmo_settings.
211
+ * Returns the user-defined priority scale, or DEFAULT_PRIORITIES if not set.
212
+ *
213
+ * Priority values are ordered strings - position in array determines sort order.
214
+ * Index 0 is highest priority.
215
+ *
216
+ * @param db - Database instance
217
+ * @returns Array of priority strings ordered from highest to lowest
218
+ */
219
+ export function getWorkspacePriorities(db) {
220
+ const row = db.prepare(`SELECT value FROM pmo_settings WHERE key = ?`).get(PRIORITIES_SETTING_KEY);
221
+ if (!row)
222
+ return [...DEFAULT_PRIORITIES];
223
+ try {
224
+ const parsed = JSON.parse(row.value);
225
+ if (Array.isArray(parsed) && parsed.length > 0 && parsed.every((p) => typeof p === 'string')) {
226
+ return parsed;
227
+ }
228
+ return [...DEFAULT_PRIORITIES];
229
+ }
230
+ catch {
231
+ return [...DEFAULT_PRIORITIES];
232
+ }
233
+ }
234
+ /**
235
+ * Set the workspace priority scale in pmo_settings.
236
+ *
237
+ * @param db - Database instance
238
+ * @param priorities - Array of priority strings ordered from highest to lowest
239
+ */
240
+ export function setWorkspacePriorities(db, priorities) {
241
+ const value = JSON.stringify(priorities);
242
+ db.prepare(`
243
+ INSERT INTO pmo_settings (key, value) VALUES (?, ?)
244
+ ON CONFLICT(key) DO UPDATE SET value = ?
245
+ `).run(PRIORITIES_SETTING_KEY, value, value);
246
+ }
247
+ /**
248
+ * Check if a value is a valid priority for the workspace.
249
+ *
250
+ * @param db - Database instance
251
+ * @param value - Value to check
252
+ * @returns true if the value is in the workspace priority scale
253
+ */
254
+ export function isValidWorkspacePriority(db, value) {
255
+ const priorities = getWorkspacePriorities(db);
256
+ return priorities.includes(value);
257
+ }
258
+ /**
259
+ * Get the sort index for a priority value.
260
+ * Returns the position in the priority array (0 = highest priority).
261
+ * Returns Infinity for unknown priorities (sorts last).
262
+ *
263
+ * @param db - Database instance
264
+ * @param value - Priority value
265
+ * @returns Sort index (lower = higher priority)
266
+ */
267
+ export function getPrioritySortIndex(db, value) {
268
+ if (!value)
269
+ return Infinity;
270
+ const priorities = getWorkspacePriorities(db);
271
+ const index = priorities.indexOf(value);
272
+ return index >= 0 ? index : Infinity;
273
+ }