@cosxai/ui 0.13.5 → 0.14.0
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 +1 -1
- package/src/command/rank.ts +5 -0
- package/src/command/types.ts +6 -0
package/package.json
CHANGED
package/src/command/rank.ts
CHANGED
|
@@ -16,6 +16,11 @@ interface Ranked {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
function scoreOne(item: CommandItem, q: string): number | null {
|
|
19
|
+
// Secret items exist only for their exact phrase — never in empty
|
|
20
|
+
// listings, never via partial/label matches.
|
|
21
|
+
if (item.secret) {
|
|
22
|
+
return q.trim().toLowerCase() === item.secret.toLowerCase() ? 200 : null;
|
|
23
|
+
}
|
|
19
24
|
if (!q) return 1; // empty query — everyone passes, sorted by registration order
|
|
20
25
|
const ql = q.toLowerCase();
|
|
21
26
|
const lab = item.label.toLowerCase();
|
package/src/command/types.ts
CHANGED
|
@@ -23,4 +23,10 @@ export interface CommandItem {
|
|
|
23
23
|
// palette — useful when the command opens a sub-flow that wants
|
|
24
24
|
// to keep the palette open.
|
|
25
25
|
run: (api: { close: () => void }) => void;
|
|
26
|
+
// Cheat-code gating: when set, the item is INVISIBLE to every
|
|
27
|
+
// query except an exact (case-insensitive, trimmed) match of this
|
|
28
|
+
// phrase — it never appears in empty-query listings or partial
|
|
29
|
+
// matches. Use for hidden debug/test menus; pair with a "Debug"
|
|
30
|
+
// group so the reveal is self-describing.
|
|
31
|
+
secret?: string;
|
|
26
32
|
}
|