@pi-unipi/command-enchantment 0.1.1 → 0.1.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": "@pi-unipi/command-enchantment",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Enhanced TUI autocomplete for /unipi:* commands — colored, sorted, and grouped by package",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/constants.ts CHANGED
@@ -20,6 +20,7 @@ export const PACKAGE_ORDER: string[] = [
20
20
  "workflow",
21
21
  "ralph",
22
22
  "memory",
23
+ "milestone",
23
24
  "mcp",
24
25
  "utility",
25
26
  "ask-user",
@@ -27,6 +28,7 @@ export const PACKAGE_ORDER: string[] = [
27
28
  "web-api",
28
29
  "compact",
29
30
  "notify",
31
+ "kanboard",
30
32
  ];
31
33
 
32
34
  // ─── Package Colors ──────────────────────────────────────────────────
@@ -35,6 +37,7 @@ export const PACKAGE_COLORS: Record<string, string> = {
35
37
  workflow: `${ESC}[91m`, // Bright Red
36
38
  ralph: `${ESC}[33m`, // Yellow/Orange
37
39
  memory: `${ESC}[93m`, // Bright Yellow
40
+ milestone: `${ESC}[32m`, // Green
38
41
  mcp: `${ESC}[32m`, // Green
39
42
  utility: `${ESC}[36m`, // Cyan
40
43
  "ask-user": `${ESC}[94m`, // Bright Blue
@@ -42,6 +45,7 @@ export const PACKAGE_COLORS: Record<string, string> = {
42
45
  "web-api": `${ESC}[95m`, // Bright Magenta
43
46
  compact: `${ESC}[37m`, // White
44
47
  notify: `${ESC}[96m`, // Bright Cyan
48
+ kanboard: `${ESC}[92m`, // Bright Green
45
49
  };
46
50
 
47
51
  // ─── Command Registry ────────────────────────────────────────────────
@@ -90,12 +94,15 @@ export const COMMAND_REGISTRY: Record<string, string> = {
90
94
  "unipi:mcp-reload": "mcp",
91
95
 
92
96
  // utility (6 commands)
93
- "unipi:continue": "utility",
94
- "unipi:reload": "utility",
95
- "unipi:status": "utility",
96
- "unipi:cleanup": "utility",
97
- "unipi:env": "utility",
98
- "unipi:doctor": "utility",
97
+ "unipi:continue": "utility",
98
+ "unipi:reload": "utility",
99
+ "unipi:status": "utility",
100
+ "unipi:cleanup": "utility",
101
+ "unipi:env": "utility",
102
+ "unipi:doctor": "utility",
103
+ "unipi:name-badge": "utility",
104
+ "unipi:badge-gen": "utility",
105
+ "unipi:badge-toggle": "utility",
99
106
 
100
107
  // ask-user (1 command)
101
108
  "unipi:ask-user-settings": "ask-user",
@@ -119,11 +126,21 @@ export const COMMAND_REGISTRY: Record<string, string> = {
119
126
  "unipi:compact-search": "compact",
120
127
  "unipi:compact-purge": "compact",
121
128
 
129
+ // milestone (2 commands)
130
+ "unipi:milestone-onboard": "milestone",
131
+ "unipi:milestone-update": "milestone",
132
+
122
133
  // notify (4 commands)
123
134
  "unipi:notify-settings": "notify",
124
135
  "unipi:notify-set-gotify": "notify",
125
136
  "unipi:notify-set-tg": "notify",
126
137
  "unipi:notify-test": "notify",
138
+
139
+ // kanboard (4 commands)
140
+ "unipi:kanboard": "kanboard",
141
+ "unipi:kanboard-doctor": "kanboard",
142
+ "unipi:kanboard-settings": "kanboard",
143
+ "unipi:name-gen": "kanboard",
127
144
  };
128
145
 
129
146
  // ─── Description Map ─────────────────────────────────────────────────
@@ -167,12 +184,17 @@ export const COMMAND_DESCRIPTIONS: Record<string, string> = {
167
184
  "unipi:mcp-settings": "Configure MCP settings",
168
185
  "unipi:mcp-reload": "Reload MCP connections",
169
186
 
170
- "unipi:continue": "Continue the last conversation",
171
- "unipi:reload": "Reload extensions and settings",
172
- "unipi:status": "Show system status",
173
- "unipi:cleanup": "Clean up old sessions and cache",
174
- "unipi:env": "Show environment info",
175
- "unipi:doctor": "Run diagnostics",
187
+ "unipi:continue": "Continue the last conversation",
188
+ "unipi:reload": "Reload extensions and settings",
189
+ "unipi:status": "Show system status",
190
+ "unipi:cleanup": "Clean up old sessions and cache",
191
+ "unipi:env": "Show environment info",
192
+ "unipi:doctor": "Run diagnostics",
193
+ "unipi:name-badge": "Toggle session name badge overlay",
194
+ "unipi:badge-gen": "Generate session name via background agent",
195
+ "unipi:badge-toggle": "Configure badge settings (autoGen, badgeEnabled, agentTool)",
196
+ "unipi:name-gen": "Generate session name badge from kanboard context",
197
+ "unipi:kanboard-settings": "Configure kanboard module settings",
176
198
 
177
199
  "unipi:ask-user-settings": "Configure ask-user settings",
178
200
 
@@ -196,6 +218,12 @@ export const COMMAND_DESCRIPTIONS: Record<string, string> = {
196
218
  "unipi:notify-set-gotify": "Set up Gotify push notifications",
197
219
  "unipi:notify-set-tg": "Set up Telegram bot notifications",
198
220
  "unipi:notify-test": "Test all enabled notification platforms",
221
+
222
+ "unipi:kanboard": "Start the kanboard visualization server",
223
+ "unipi:kanboard-doctor": "Diagnose and fix kanboard parser issues",
224
+
225
+ "unipi:milestone-onboard": "Create MILESTONES.md from existing workflow docs",
226
+ "unipi:milestone-update": "Sync MILESTONES.md with completed work",
199
227
  };
200
228
 
201
229
  // ─── Package Display Names ───────────────────────────────────────────
@@ -204,6 +232,7 @@ export const PACKAGE_LABELS: Record<string, string> = {
204
232
  workflow: "workflow",
205
233
  ralph: "ralph",
206
234
  memory: "memory",
235
+ milestone: "milestone",
207
236
  mcp: "mcp",
208
237
  utility: "utility",
209
238
  "ask-user": "ask-user",
@@ -211,4 +240,5 @@ export const PACKAGE_LABELS: Record<string, string> = {
211
240
  "web-api": "web-api",
212
241
  compact: "compact",
213
242
  notify: "notify",
243
+ kanboard: "kanboard",
214
244
  };
package/src/provider.ts CHANGED
@@ -52,6 +52,7 @@ function detectNamespaceBoost(query: string): string | null {
52
52
  workflow: "workflow",
53
53
  ralph: "ralph",
54
54
  memory: "memory",
55
+ milestone: "milestone",
55
56
  mcp: "mcp",
56
57
  utility: "utility",
57
58
  "ask-user": "ask-user",
@@ -61,6 +62,8 @@ function detectNamespaceBoost(query: string): string | null {
61
62
  notify: "notify",
62
63
  // Unambiguous short aliases
63
64
  mem: "memory",
65
+ ms: "milestone",
66
+ goal: "milestone",
64
67
  util: "utility",
65
68
  web: "web-api",
66
69
  notification: "notify",
@@ -117,7 +120,18 @@ function getEnhancedUnipiItems(
117
120
  });
118
121
  }
119
122
 
120
- // Sort: boosted package first, then by PACKAGE_ORDER, then alphabetically.
123
+ // Determine match quality for ranking exact > prefix > fuzzy
124
+ const getMatchPriority = (cmd: string): number => {
125
+ const name = isPastUnipiColon
126
+ ? cmd.replace("unipi:", "").toLowerCase()
127
+ : cmd.toLowerCase();
128
+ if (name === query) return 0; // Exact match
129
+ if (name.startsWith(query)) return 1; // Prefix match
130
+ return 2; // Fuzzy match
131
+ };
132
+
133
+ // Sort: boosted package first, then exact > prefix > fuzzy,
134
+ // then by PACKAGE_ORDER, then alphabetically.
121
135
  matched.sort((a, b) => {
122
136
  const pkgA = a[1];
123
137
  const pkgB = b[1];
@@ -129,6 +143,11 @@ function getEnhancedUnipiItems(
129
143
  if (!aIsBoosted && bIsBoosted) return 1;
130
144
  }
131
145
 
146
+ // Rank by match quality: exact > prefix > fuzzy
147
+ const priA = getMatchPriority(a[0]);
148
+ const priB = getMatchPriority(b[0]);
149
+ if (priA !== priB) return priA - priB;
150
+
132
151
  const orderA = PACKAGE_ORDER.indexOf(pkgA);
133
152
  const orderB = PACKAGE_ORDER.indexOf(pkgB);
134
153
  if (orderA !== orderB) return orderA - orderB;
@@ -262,7 +281,7 @@ export function createEnchantedProvider(
262
281
  : null;
263
282
  }
264
283
 
265
- // Merge: non-unipi first, then enhanced unipi (sorted by package)
284
+ // Merge: system commands first, then enhanced unipi (sorted by package)
266
285
  return {
267
286
  items: [...nonUnipiItems, ...enhancedUnipiItems],
268
287
  prefix: effectivePrefix,