hex/sdk/commands/workspace-template/hex.config.ts
Kit Langton 9e9da53aa9 docs: audit guides against current behavior
Align desktop projections, processing fallback, history retention, contributor setup, Linux requirements, SDK contracts, and personal command examples with the implementation. Clarify prototype cleanup and historical validation limits without rewriting published release notes.
2026-09-01 09:56:40 -04:00

45 lines
1.7 KiB
TypeScript

import { choice, defineHexConfig, digit, letter, union } from "@hex/commands"
export default defineHexConfig({
// Transformations appear as optional final steps in every dictation mode.
// transformations: {
// "trim-whitespace": {
// name: "Trim whitespace",
// description: "Remove leading and trailing whitespace",
// transform: (text) => text.trim(),
// },
// },
// Uncomment this block to replace HEX's native voice-dictation protocol.
// dictation: {
// start: ["begin note"],
// stop: ["finish note"],
// send: ["send note"],
// cancel: ["discard note"],
// },
commands: {
"open-example": {
phrases: ["open example"],
group: "Websites",
description: "Open the example site",
run: ({ hex }) => hex.openUrl("https://example.com"),
},
// A trailing {capture} placeholder collects the rest of the spoken
// phrase: "search amazon for wool socks" -> captures.query === "wool socks".
"search-amazon": {
phrases: ["search amazon for {query}"],
group: "Websites",
description: "Search Amazon for the spoken words",
run: ({ hex, captures }) =>
hex.openUrl(`https://www.amazon.com/s?k=${encodeURIComponent(captures.query ?? "")}`),
},
// Explicit descriptors compose multiple captures and infer exact handler types.
"control-key": {
phrases: ["control {key}"],
captures: { key: union(letter(), digit(), choice(["home", "end"] as const)) },
group: "Keyboard",
description: "Press Control plus a letter, digit, Home, or End",
run: ({ hex, captures }) =>
hex.press({ key: String(captures.key), modifiers: ["control"] }),
},
},
})