defineIntent()
defineIntent() is the single entry point for authoring an App Intent in
TypeScript. Every field below flows through the IR into the generated Swift.
Signature
Section titled “Signature”import { defineIntent, param } from "@axint/compiler";
defineIntent({ name: string; // Swift type name (must end in "Intent") title: string; // Human-facing title in Shortcuts description: string; // Human-facing description domain: IntentDomain; // "messaging" | "productivity" | ...
params?: Record<string, ParamSpec>; entitlements?: string[]; infoPlistKeys?: Record<string, string>; isDiscoverable?: boolean; // default: true
perform?: () => unknown; // optional; used for return-type inference});Required fields
Section titled “Required fields”The Swift struct name. Must be a valid Swift identifier ending in Intent.
name: "SendMessageIntent" // ✅name: "SendMessage" // ❌ AX100: must end in "Intent"name: "send-message" // ❌ AX100: not a valid Swift identifierHuman-facing title shown in Shortcuts and the Siri prompt sheet.
description
Section titled “description”Longer description shown in Shortcuts. Keep it under ~140 characters.
domain
Section titled “domain”One of Apple’s standard App Intent domains:
messaging, productivity, transportation, navigation, music,
finance, health, smartHome, commerce, utility.
Optional fields
Section titled “Optional fields”params
Section titled “params”Object literal mapping parameter names to param.* calls.
params: { recipient: param.string("Who to send the message to"), body: param.string("What to say"),}entitlements
Section titled “entitlements”Array of reverse-DNS entitlement identifiers.
entitlements: ["com.apple.developer.healthkit"]infoPlistKeys
Section titled “infoPlistKeys”Map of Info.plist usage description keys to their human-facing permission copy.
infoPlistKeys: { NSHealthUpdateUsageDescription: "Log workouts to HealthKit."}isDiscoverable
Section titled “isDiscoverable”Whether the intent shows up in Shortcuts’ action library. Defaults to true.
Set to false for background-only intents.
perform
Section titled “perform”An optional stub function. If present, Axint walks its body to infer the
Swift return type. If absent, the generated perform() returns
.result() with no value.
perform: () => ({ orderId: "42", total: 19.99,})// → generates `-> some IntentResult & ReturnsValue<OrderConfirmation>`