@pi-unipi/command-enchantment 2.0.4 → 2.0.5

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/README.md CHANGED
@@ -9,6 +9,7 @@ Command Enchantment has no user commands. It improves the editor autocomplete ex
9
9
  ## What It Does
10
10
 
11
11
  - Groups `/unipi:*` commands by package so workflow, memory, web, footer, and other commands are visually distinct.
12
+ - Shows full command values like `unipi:brainstorm` while replacing Pi source tags with concise package tags like `[workflow]`.
12
13
  - Sorts matches in predictable tiers: exact Unipi matches first, then other Unipi matches, then system commands.
13
14
  - Preserves dynamic argument completions from command providers, including workflow document and worktree suggestions.
14
15
  - Ships an audit test that checks registered Unipi commands are represented in the autocomplete registry and have descriptions.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-unipi/command-enchantment",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
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/provider.ts CHANGED
@@ -43,6 +43,18 @@ function fuzzyMatch(text: string, query: string): boolean {
43
43
 
44
44
  // ─── Namespace detection ─────────────────────────────────────────────
45
45
 
46
+ /**
47
+ * Pi prefixes extension command descriptions with source tags such as
48
+ * `[u:npm:@pi-unipi/unipi]`. The enchanted provider replaces that with
49
+ * package tags (`[workflow]`, `[memory]`, …), so strip the source tag from
50
+ * base descriptions before reusing them.
51
+ */
52
+ function stripPiSourceTag(description: string): string {
53
+ return description
54
+ .replace(/^\[(?:[upt])(?::[^\]]+)?\]\s*/, "")
55
+ .trimStart();
56
+ }
57
+
46
58
  /**
47
59
  * If the query looks like a package namespace (e.g. "workflow", "memory",
48
60
  * "utility"), return that package name so its commands sort to the top.
@@ -174,7 +186,7 @@ function getEnhancedUnipiItems(
174
186
 
175
187
  return {
176
188
  value: cmd,
177
- label: cmd.replace("unipi:", ""),
189
+ label: cmd,
178
190
  description: desc ? `${tag} ${desc}` : tag,
179
191
  };
180
192
  });
@@ -261,7 +273,10 @@ export function createEnchantedProvider(
261
273
  for (const item of baseSuggestions.items) {
262
274
  if (item.value.startsWith("unipi:")) {
263
275
  if (item.description) {
264
- descriptionOverrides.set(item.value, item.description);
276
+ const cleanDescription = stripPiSourceTag(item.description);
277
+ if (cleanDescription) {
278
+ descriptionOverrides.set(item.value, cleanDescription);
279
+ }
265
280
  }
266
281
  } else {
267
282
  nonUnipiItems.push(item);