@dinachi/cli 1.0.0 → 1.3.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.
Files changed (105) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/dist/index.js +244 -72
  3. package/package.json +5 -1
  4. package/templates/accordion/accordion.tsx +5 -1
  5. package/templates/agent/agent.tsx +35 -18
  6. package/templates/alert/alert.tsx +345 -0
  7. package/templates/alert/index.ts +16 -0
  8. package/templates/alert-dialog/alert-dialog.tsx +14 -3
  9. package/templates/animated-icon/animated-icon.tsx +1 -0
  10. package/templates/animated-list/animated-list.tsx +2 -1
  11. package/templates/animated-tabs/animated-tabs.tsx +4 -0
  12. package/templates/ask-bar/ask-bar.tsx +1061 -0
  13. package/templates/ask-bar/index.ts +1 -0
  14. package/templates/autocomplete/autocomplete.tsx +14 -4
  15. package/templates/avatar/avatar.tsx +3 -0
  16. package/templates/badge/badge.tsx +1 -0
  17. package/templates/breadcrumb/breadcrumb.tsx +606 -0
  18. package/templates/breadcrumb/index.ts +9 -0
  19. package/templates/button/button.tsx +1 -0
  20. package/templates/calendar/calendar.tsx +1155 -0
  21. package/templates/calendar/index.ts +15 -0
  22. package/templates/card/card.tsx +6 -1
  23. package/templates/carousel/carousel.tsx +7 -0
  24. package/templates/checkbox/checkbox.tsx +1 -0
  25. package/templates/checkbox-group/checkbox-group.tsx +1 -0
  26. package/templates/collapsible/collapsible.tsx +3 -1
  27. package/templates/combobox/combobox.tsx +15 -4
  28. package/templates/command-items/command-items.tsx +69 -0
  29. package/templates/command-items/index.ts +1 -0
  30. package/templates/command-palette/command-palette.tsx +954 -0
  31. package/templates/command-palette/index.ts +1 -0
  32. package/templates/compare-slider/compare-slider.tsx +1 -0
  33. package/templates/comparison-table/comparison-table.tsx +540 -0
  34. package/templates/comparison-table/index.ts +15 -0
  35. package/templates/context-menu/context-menu.tsx +61 -14
  36. package/templates/data-table/data-table.tsx +2077 -0
  37. package/templates/data-table/index.ts +14 -0
  38. package/templates/date-picker/date-picker.tsx +527 -0
  39. package/templates/date-picker/index.ts +2 -0
  40. package/templates/date-range-picker/date-range-picker.tsx +504 -0
  41. package/templates/date-range-picker/index.ts +2 -0
  42. package/templates/detail-list/detail-list.tsx +419 -0
  43. package/templates/detail-list/index.ts +12 -0
  44. package/templates/dialog/dialog.tsx +13 -3
  45. package/templates/drawer/drawer.tsx +19 -6
  46. package/templates/expandable-card/expandable-card.tsx +5 -1
  47. package/templates/field/field.tsx +5 -1
  48. package/templates/fieldset/fieldset.tsx +2 -0
  49. package/templates/form/form.tsx +1 -0
  50. package/templates/heat-table/heat-table.tsx +613 -0
  51. package/templates/heat-table/index.ts +9 -0
  52. package/templates/hold-to-confirm/hold-to-confirm.tsx +1 -0
  53. package/templates/input/input.tsx +1 -0
  54. package/templates/label/label.tsx +1 -0
  55. package/templates/link/link.tsx +1 -0
  56. package/templates/load-transition/load-transition.tsx +1 -0
  57. package/templates/marquee/marquee.tsx +1 -0
  58. package/templates/menu/menu.tsx +27 -6
  59. package/templates/menubar/menubar.tsx +15 -3
  60. package/templates/meter/meter.tsx +5 -1
  61. package/templates/month-picker/index.ts +1 -0
  62. package/templates/month-picker/month-picker.tsx +351 -0
  63. package/templates/navigation-menu/navigation-menu.tsx +13 -2
  64. package/templates/number-field/number-field.tsx +7 -1
  65. package/templates/number-ticker/number-ticker.tsx +3 -0
  66. package/templates/omnibar/index.ts +1 -0
  67. package/templates/omnibar/omnibar.tsx +1009 -0
  68. package/templates/otp-field/otp-field.tsx +4 -0
  69. package/templates/pagination/index.ts +8 -0
  70. package/templates/pagination/pagination.tsx +389 -0
  71. package/templates/popover/popover.tsx +19 -5
  72. package/templates/preview-card/preview-card.tsx +11 -3
  73. package/templates/progress/progress.tsx +5 -1
  74. package/templates/progress-ring/progress-ring.tsx +1 -0
  75. package/templates/radio/radio.tsx +3 -0
  76. package/templates/scroll-area/scroll-area.tsx +14 -4
  77. package/templates/scroll-progress/scroll-progress.tsx +1 -0
  78. package/templates/scroll-reveal/scroll-reveal.tsx +1 -0
  79. package/templates/select/select.tsx +18 -2
  80. package/templates/separator/separator.tsx +1 -0
  81. package/templates/skeleton/skeleton.tsx +1 -0
  82. package/templates/slider/slider.tsx +7 -0
  83. package/templates/sortable/sortable.tsx +3 -0
  84. package/templates/stagger-list/stagger-list.tsx +2 -0
  85. package/templates/streaming-text/streaming-text.tsx +1 -0
  86. package/templates/swipeable-row/swipeable-row.tsx +1 -0
  87. package/templates/switch/switch.tsx +2 -0
  88. package/templates/table/index.ts +13 -0
  89. package/templates/table/table.tsx +265 -0
  90. package/templates/tabs/tabs.tsx +5 -0
  91. package/templates/text/text.tsx +1 -0
  92. package/templates/text-morph/text-morph.tsx +2 -0
  93. package/templates/text-shimmer/text-shimmer.tsx +1 -0
  94. package/templates/textarea/textarea.tsx +1 -0
  95. package/templates/time-slots/index.ts +1 -0
  96. package/templates/time-slots/time-slots.tsx +589 -0
  97. package/templates/toast/toast.tsx +10 -1
  98. package/templates/toggle/toggle.tsx +1 -0
  99. package/templates/toggle-group/toggle-group.tsx +2 -0
  100. package/templates/toolbar/toolbar.tsx +6 -0
  101. package/templates/tooltip/tooltip.tsx +9 -3
  102. package/templates/week-strip/index.ts +1 -0
  103. package/templates/week-strip/week-strip.tsx +329 -0
  104. package/templates/year-view/index.ts +1 -0
  105. package/templates/year-view/year-view.tsx +362 -0
@@ -0,0 +1,15 @@
1
+ export {
2
+ Calendar,
3
+ parseDate,
4
+ dayFirst,
5
+ startOfDay,
6
+ addDays,
7
+ addMonths,
8
+ isSameDay,
9
+ daysBetween,
10
+ monthsBetween,
11
+ isoWeek,
12
+ toISODate,
13
+ fromISODate,
14
+ } from "./calendar";
15
+ export type { CalendarProps, CalendarMode, CalendarChangeDetails, DateRange, ParseDateOptions } from "./calendar";
@@ -6,6 +6,7 @@ const Card = React.forwardRef<
6
6
  React.HTMLAttributes<HTMLDivElement>
7
7
  >(({ className, ...props }, ref) => (
8
8
  <div
9
+ data-slot="card"
9
10
  ref={ref}
10
11
  className={cn(
11
12
  "rounded-lg border bg-card text-card-foreground shadow-sm",
@@ -21,6 +22,7 @@ const CardHeader = React.forwardRef<
21
22
  React.HTMLAttributes<HTMLDivElement>
22
23
  >(({ className, ...props }, ref) => (
23
24
  <div
25
+ data-slot="card-header"
24
26
  ref={ref}
25
27
  className={cn("flex flex-col space-y-1.5 p-6", className)}
26
28
  {...props}
@@ -33,6 +35,7 @@ const CardTitle = React.forwardRef<
33
35
  React.HTMLAttributes<HTMLHeadingElement>
34
36
  >(({ className, ...props }, ref) => (
35
37
  <h3
38
+ data-slot="card-title"
36
39
  ref={ref}
37
40
  className={cn(
38
41
  "text-2xl font-medium leading-none tracking-tight",
@@ -48,6 +51,7 @@ const CardDescription = React.forwardRef<
48
51
  React.HTMLAttributes<HTMLParagraphElement>
49
52
  >(({ className, ...props }, ref) => (
50
53
  <p
54
+ data-slot="card-description"
51
55
  ref={ref}
52
56
  className={cn("text-sm text-muted-foreground", className)}
53
57
  {...props}
@@ -59,7 +63,7 @@ const CardContent = React.forwardRef<
59
63
  HTMLDivElement,
60
64
  React.HTMLAttributes<HTMLDivElement>
61
65
  >(({ className, ...props }, ref) => (
62
- <div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
66
+ <div data-slot="card-content" ref={ref} className={cn("p-6 pt-0", className)} {...props} />
63
67
  ))
64
68
  CardContent.displayName = "CardContent"
65
69
 
@@ -68,6 +72,7 @@ const CardFooter = React.forwardRef<
68
72
  React.HTMLAttributes<HTMLDivElement>
69
73
  >(({ className, ...props }, ref) => (
70
74
  <div
75
+ data-slot="card-footer"
71
76
  ref={ref}
72
77
  className={cn("flex items-center p-6 pt-0", className)}
73
78
  {...props}
@@ -255,6 +255,7 @@ const Carousel = React.forwardRef<HTMLDivElement, CarouselProps>(
255
255
  aria-label={label}
256
256
  data-disabled={disabled ? "" : undefined}
257
257
  className={cn("space-y-4", className)}
258
+ data-slot="carousel"
258
259
  {...props}
259
260
  >
260
261
  {children}
@@ -343,6 +344,7 @@ const CarouselViewport = React.forwardRef<HTMLDivElement, CarouselViewportProps>
343
344
  disabled ? "overflow-x-hidden" : "overflow-x-auto",
344
345
  className
345
346
  )}
347
+ data-slot="carousel-viewport"
346
348
  {...props}
347
349
  >
348
350
  {positioned}
@@ -363,6 +365,7 @@ const CarouselViewport = React.forwardRef<HTMLDivElement, CarouselViewportProps>
363
365
  <div
364
366
  ref={mergeRefs(ref, scroller)}
365
367
  className={cn("overflow-hidden", className)}
368
+ data-slot="carousel-viewport"
366
369
  {...props}
367
370
  >
368
371
  <motion.div
@@ -410,6 +413,7 @@ const CarouselSlide = React.forwardRef<HTMLDivElement, CarouselSlideProps>(
410
413
  aria-roledescription="slide"
411
414
  aria-label={label ? `${counted}: ${label}` : counted}
412
415
  className={cn("w-[72%] shrink-0 snap-start", className)}
416
+ data-slot="carousel-slide"
413
417
  {...props}
414
418
  />
415
419
  )
@@ -441,6 +445,7 @@ const CarouselDots = React.forwardRef<HTMLDivElement, CarouselDotsProps>(
441
445
  role="group"
442
446
  aria-label="Choose a slide"
443
447
  className={cn("flex gap-1.5", className)}
448
+ data-slot="carousel-dots"
444
449
  {...props}
445
450
  >
446
451
  {Array.from({ length: count }, (_, i) => (
@@ -482,6 +487,7 @@ const CarouselPrevious = React.forwardRef<HTMLButtonElement, CarouselArrowProps>
482
487
  data-agent-part={usePart()}
483
488
  onClick={(event) => goTo(index - 1, personChange("arrow-press", event.nativeEvent))}
484
489
  className={cn(arrowClass, className)}
490
+ data-slot="carousel-previous"
485
491
  {...props}
486
492
  >
487
493
  {children ?? <ChevronIcon direction="left" />}
@@ -504,6 +510,7 @@ const CarouselNext = React.forwardRef<HTMLButtonElement, CarouselArrowProps>(
504
510
  data-agent-part={usePart()}
505
511
  onClick={(event) => goTo(index + 1, personChange("arrow-press", event.nativeEvent))}
506
512
  className={cn(arrowClass, className)}
513
+ data-slot="carousel-next"
507
514
  {...props}
508
515
  >
509
516
  {children ?? <ChevronIcon direction="right" />}
@@ -63,6 +63,7 @@ const Checkbox = React.forwardRef<
63
63
  <span className="relative inline-flex [&>input]:!absolute">
64
64
  <BaseCheckbox.Root
65
65
  ref={mergedRef}
66
+ data-slot="checkbox"
66
67
  className={cn(
67
68
  "peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
68
69
  "data-[checked]:bg-primary data-[checked]:text-primary-foreground",
@@ -78,6 +78,7 @@ const CheckboxGroup = React.forwardRef<
78
78
  <AgentGroupContext.Provider value={useHasAgent() ? agent : null}>
79
79
  <BaseCheckboxGroup
80
80
  ref={mergedRef}
81
+ data-slot="checkbox-group"
81
82
  className={cn("flex flex-col items-start gap-1", className)}
82
83
  {...props}
83
84
  value={value}
@@ -15,7 +15,7 @@ const Collapsible = React.forwardRef<
15
15
  const [state, change, parts] = useAgentOpen("disclosure", open, defaultOpen, onOpenChange)
16
16
  return (
17
17
  <CollapsibleAgentContext.Provider value={useHasAgent() ? parts : null}>
18
- <BaseCollapsible.Root ref={ref} className={cn("w-full", className)} {...props} open={state} onOpenChange={change} />
18
+ <BaseCollapsible.Root data-slot="collapsible" ref={ref} className={cn("w-full", className)} {...props} open={state} onOpenChange={change} />
19
19
  </CollapsibleAgentContext.Provider>
20
20
  )
21
21
  })
@@ -26,6 +26,7 @@ const CollapsibleTrigger = React.forwardRef<
26
26
  React.ComponentPropsWithoutRef<typeof BaseCollapsible.Trigger>
27
27
  >(({ className, ...props }, ref) => (
28
28
  <BaseCollapsible.Trigger
29
+ data-slot="collapsible-trigger"
29
30
  ref={useMergedRef(ref, React.useContext(CollapsibleAgentContext)?.trigger)}
30
31
  className={cn(
31
32
  "flex w-full items-center justify-between rounded-md p-4 font-medium transition-colors",
@@ -45,6 +46,7 @@ const CollapsiblePanel = React.forwardRef<
45
46
  React.ComponentPropsWithoutRef<typeof BaseCollapsible.Panel>
46
47
  >(({ className, ...props }, ref) => (
47
48
  <BaseCollapsible.Panel
49
+ data-slot="collapsible-panel"
48
50
  ref={ref}
49
51
  className={cn(
50
52
  "overflow-hidden text-sm h-[var(--collapsible-panel-height)]",
@@ -108,7 +108,6 @@ function typeInto(s: ComboboxAgent, input: HTMLInputElement, text: string) {
108
108
 
109
109
  /** Waits a turn for React to filter, then for the list to be open with every item registered. */
110
110
  async function settled({ list, items }: ComboboxAgent) {
111
- await new Promise((resolve) => setTimeout(resolve))
112
111
  await waitForAgent(
113
112
  () => list.current?.isConnected && list.current.querySelectorAll('[role="option"]').length === items.size
114
113
  )
@@ -268,7 +267,9 @@ const Combobox = ComboboxRoot as unknown as typeof ComboboxPrimitive.Root
268
267
  const ComboboxValue = ComboboxPrimitive.Value
269
268
  const ComboboxCollection = ComboboxPrimitive.Collection
270
269
  const ComboboxPortal = ComboboxPrimitive.Portal
271
- const ComboboxInputGroup = ComboboxPrimitive.InputGroup
270
+ function ComboboxInputGroup(props: React.ComponentProps<typeof ComboboxPrimitive.InputGroup>) {
271
+ return <ComboboxPrimitive.InputGroup data-slot="combobox-input-group" {...props} />
272
+ }
272
273
  const createComboboxItems = ComboboxPrimitive.createItems
273
274
 
274
275
  const ComboboxInput = React.forwardRef<
@@ -276,6 +277,7 @@ const ComboboxInput = React.forwardRef<
276
277
  React.ComponentPropsWithoutRef<typeof ComboboxPrimitive.Input>
277
278
  >(({ className, ...props }, ref) => (
278
279
  <ComboboxPrimitive.Input
280
+ data-slot="combobox-input"
279
281
  ref={useMergedRef(ref, React.useContext(ComboboxAgentContext)?.input)}
280
282
  className={cn(
281
283
  "flex h-10 w-full bg-transparent px-3 py-2 text-sm",
@@ -294,6 +296,7 @@ const ComboboxTrigger = React.forwardRef<
294
296
  React.ComponentPropsWithoutRef<typeof ComboboxPrimitive.Trigger>
295
297
  >(({ className, children, ...props }, ref) => (
296
298
  <ComboboxPrimitive.Trigger
299
+ data-slot="combobox-trigger"
297
300
  ref={ref}
298
301
  className={cn(
299
302
  "inline-flex h-10 items-center justify-center px-3",
@@ -317,6 +320,7 @@ const ComboboxClear = React.forwardRef<
317
320
  React.ComponentPropsWithoutRef<typeof ComboboxPrimitive.Clear>
318
321
  >(({ className, children, ...props }, ref) => (
319
322
  <ComboboxPrimitive.Clear
323
+ data-slot="combobox-clear"
320
324
  ref={ref}
321
325
  className={cn(
322
326
  "inline-flex h-8 w-8 items-center justify-center rounded-sm text-muted-foreground",
@@ -339,6 +343,7 @@ const ComboboxContent = React.forwardRef<
339
343
  const content = (
340
344
  <ComboboxPrimitive.Positioner sideOffset={4}>
341
345
  <ComboboxPrimitive.Popup
346
+ data-slot="combobox-content"
342
347
  ref={ref}
343
348
  className={cn(
344
349
  "relative z-50 min-w-[var(--anchor-width)] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
@@ -365,6 +370,7 @@ const ComboboxList = React.forwardRef<
365
370
  React.ComponentPropsWithoutRef<typeof ComboboxPrimitive.List>
366
371
  >(({ className, ...props }, ref) => (
367
372
  <ComboboxPrimitive.List
373
+ data-slot="combobox-list"
368
374
  ref={useMergedRef(ref, React.useContext(ComboboxAgentContext)?.list)}
369
375
  className={cn("max-h-80 overflow-y-auto p-1", className)}
370
376
  {...props}
@@ -393,6 +399,7 @@ const ComboboxItem = React.forwardRef<
393
399
 
394
400
  return (
395
401
  <ComboboxPrimitive.Item
402
+ data-slot="combobox-item"
396
403
  ref={useMergedRef(ref, element)}
397
404
  className={cn(
398
405
  "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none",
@@ -418,7 +425,7 @@ const ComboboxGroup = React.forwardRef<
418
425
  React.ComponentRef<typeof ComboboxPrimitive.Group>,
419
426
  React.ComponentPropsWithoutRef<typeof ComboboxPrimitive.Group>
420
427
  >(({ className, ...props }, ref) => (
421
- <ComboboxPrimitive.Group ref={ref} className={cn(className)} {...props} />
428
+ <ComboboxPrimitive.Group data-slot="combobox-group" ref={ref} className={cn(className)} {...props} />
422
429
  ))
423
430
  ComboboxGroup.displayName = "ComboboxGroup"
424
431
 
@@ -427,6 +434,7 @@ const ComboboxGroupLabel = React.forwardRef<
427
434
  React.ComponentPropsWithoutRef<typeof ComboboxPrimitive.GroupLabel>
428
435
  >(({ className, ...props }, ref) => (
429
436
  <ComboboxPrimitive.GroupLabel
437
+ data-slot="combobox-group-label"
430
438
  ref={ref}
431
439
  className={cn("px-2 py-1.5 text-xs font-medium text-muted-foreground", className)}
432
440
  {...props}
@@ -439,6 +447,7 @@ const ComboboxEmpty = React.forwardRef<
439
447
  React.ComponentPropsWithoutRef<typeof ComboboxPrimitive.Empty>
440
448
  >(({ className, ...props }, ref) => (
441
449
  <ComboboxPrimitive.Empty
450
+ data-slot="combobox-empty"
442
451
  ref={ref}
443
452
  className={cn("p-2 text-center text-sm text-muted-foreground", className)}
444
453
  {...props}
@@ -450,7 +459,7 @@ const ComboboxStatus = React.forwardRef<
450
459
  React.ComponentRef<typeof ComboboxPrimitive.Status>,
451
460
  React.ComponentPropsWithoutRef<typeof ComboboxPrimitive.Status>
452
461
  >(({ className, ...props }, ref) => (
453
- <ComboboxPrimitive.Status ref={ref} className={cn("sr-only", className)} {...props} />
462
+ <ComboboxPrimitive.Status data-slot="combobox-status" ref={ref} className={cn("sr-only", className)} {...props} />
454
463
  ))
455
464
  ComboboxStatus.displayName = "ComboboxStatus"
456
465
 
@@ -459,6 +468,7 @@ const ComboboxLabel = React.forwardRef<
459
468
  React.ComponentPropsWithoutRef<typeof ComboboxPrimitive.Label>
460
469
  >(({ className, ...props }, ref) => (
461
470
  <ComboboxPrimitive.Label
471
+ data-slot="combobox-label"
462
472
  ref={ref}
463
473
  className={cn("block text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70", className)}
464
474
  {...props}
@@ -471,6 +481,7 @@ const ComboboxSeparator = React.forwardRef<
471
481
  React.ComponentPropsWithoutRef<typeof ComboboxPrimitive.Separator>
472
482
  >(({ className, ...props }, ref) => (
473
483
  <ComboboxPrimitive.Separator
484
+ data-slot="combobox-separator"
474
485
  ref={ref}
475
486
  className={cn("-mx-1 my-1 h-px bg-border", className)}
476
487
  {...props}
@@ -0,0 +1,69 @@
1
+ import type * as React from "react"
2
+
3
+ /**
4
+ * Something an item can do. Order is part of the contract: `actions[0]` is what Enter
5
+ * runs and `actions[1]` what Mod+Enter runs. The rest are reached from the preview.
6
+ */
7
+ export interface CommandAction {
8
+ id: string
9
+ label: string
10
+ }
11
+
12
+ /**
13
+ * One command: a page, an action or a record. Every field is plain data except `icon`
14
+ * and `meta`, which are React nodes, so a list from a server or a model sends the rest
15
+ * and the app adds those two before passing it on.
16
+ */
17
+ export interface CommandItem {
18
+ /** Unique across the whole list. */
19
+ id: string
20
+ /** What the row shows and the search matches first. */
21
+ label: string
22
+ /** A second line, also searched. */
23
+ description?: string
24
+ /** The heading the item sits under. Items with the same group are listed together. */
25
+ group?: string
26
+ /** What the item is, such as "Page" or "Order". Shown in the preview. */
27
+ kind?: string
28
+ icon?: React.ReactNode
29
+ /** A key hint, such as "G O" or "⌘ ,". Shown only; binding it is up to the app. */
30
+ shortcut?: string
31
+ /** Trailing text, such as an amount. */
32
+ meta?: React.ReactNode
33
+ /** More words the search matches, not shown. */
34
+ keywords?: string[]
35
+ disabled?: boolean
36
+ /** What it can do. Without them, running the item passes no action. */
37
+ actions?: CommandAction[]
38
+ /** A sub-list. Picking the item opens these in place of the list. */
39
+ items?: CommandItem[]
40
+ }
41
+
42
+ /**
43
+ * How a run was reached: `item-press` picks the row (a click, Enter or an agent's
44
+ * select), `action-press` a button for one action, `keyboard` Mod+Enter.
45
+ */
46
+ export type CommandRunReason = "item-press" | "action-press" | "keyboard"
47
+
48
+ /** Passed to `onRun`. `cancel()` refuses the run, which an agent is told about. */
49
+ export interface CommandRunDetails {
50
+ reason: CommandRunReason
51
+ event: Event | undefined
52
+ isCanceled: boolean
53
+ cancel(): void
54
+ }
55
+
56
+ /** True when every word of `query` is in the item's label, description or keywords. */
57
+ export function filterCommands(item: CommandItem, query: string): boolean {
58
+ const words = query.toLowerCase().split(/\s+/).filter(Boolean)
59
+ const hay = [item.label, item.description, ...(item.keywords ?? [])].join(" ").toLowerCase()
60
+ return words.every((w) => hay.includes(w))
61
+ }
62
+
63
+ /** An agent's hint: each group's actions once, so it stays short however many items there are. */
64
+ export function commandsHint(items: CommandItem[]): string {
65
+ const groups = new Map<string | undefined, Set<string>>()
66
+ for (const { group, actions = [] } of items) for (const { label } of actions) groups.set(group, (groups.get(group) ?? new Set()).add(label))
67
+ const lists = [...groups].map(([group, labels]) => (group ? `${group}: ` : "") + [...labels].join(", ")).join("; ")
68
+ return `Runs commands. select takes a label${lists && `, then an action: ${lists}`}.`
69
+ }
@@ -0,0 +1 @@
1
+ export * from "./command-items"