@axintai/compiler 0.2.1

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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/core/compiler.ts","../../src/core/parser.ts","../../src/core/types.ts","../../src/core/generator.ts","../../src/core/validator.ts"],"sourcesContent":["/**\n * Axint Compiler\n *\n * Orchestrates the full compilation pipeline:\n * 1. Parse TypeScript intent definition → IR\n * 2. Validate IR against App Intents constraints\n * 3. Generate Swift source code\n * 4. Validate generated Swift\n * 5. Optionally emit Info.plist and entitlements fragments\n *\n * This is the main entry point for the compilation process.\n */\n\nimport { readFileSync } from \"node:fs\";\nimport { parseIntentSource, ParserError } from \"./parser.js\";\nimport {\n generateSwift,\n generateInfoPlistFragment,\n generateEntitlementsFragment,\n} from \"./generator.js\";\nimport { validateIntent, validateSwiftSource } from \"./validator.js\";\nimport type { CompilerOutput, CompilerOptions, Diagnostic } from \"./types.js\";\n\nexport interface CompileResult {\n success: boolean;\n output?: CompilerOutput;\n diagnostics: Diagnostic[];\n}\n\n/**\n * Compile a TypeScript intent definition file into Swift.\n */\nexport function compileFile(\n filePath: string,\n options: Partial<CompilerOptions> = {}\n): CompileResult {\n // 1. Read source\n let source: string;\n try {\n source = readFileSync(filePath, \"utf-8\");\n } catch (_err) {\n return {\n success: false,\n diagnostics: [\n {\n code: \"AX000\",\n severity: \"error\",\n message: `Cannot read file: ${filePath}`,\n file: filePath,\n },\n ],\n };\n }\n\n return compileSource(source, filePath, options);\n}\n\n/**\n * Compile a TypeScript source string directly (no file I/O).\n * Useful for MCP server and testing.\n */\nexport function compileSource(\n source: string,\n fileName: string = \"<stdin>\",\n options: Partial<CompilerOptions> = {}\n): CompileResult {\n const diagnostics: Diagnostic[] = [];\n\n // 1. Parse → IR (catch ParserError as a diagnostic so the caller\n // sees a clean error list instead of an uncaught exception)\n let ir;\n try {\n ir = parseIntentSource(source, fileName);\n } catch (err) {\n if (err instanceof ParserError) {\n return {\n success: false,\n diagnostics: [\n {\n code: err.code,\n severity: \"error\",\n message: err.message,\n file: err.file,\n line: err.line,\n suggestion: err.suggestion,\n },\n ],\n };\n }\n throw err;\n }\n\n // 2. Validate IR\n const irDiagnostics = validateIntent(ir);\n diagnostics.push(...irDiagnostics);\n\n if (irDiagnostics.some((d) => d.severity === \"error\")) {\n return { success: false, diagnostics };\n }\n\n // 3. Generate Swift\n const swiftCode = generateSwift(ir);\n\n // 4. Validate generated Swift\n if (options.validate !== false) {\n const swiftDiagnostics = validateSwiftSource(swiftCode);\n diagnostics.push(...swiftDiagnostics);\n\n if (swiftDiagnostics.some((d) => d.severity === \"error\")) {\n return { success: false, diagnostics };\n }\n }\n\n // 5. Optional fragments\n const infoPlistFragment = options.emitInfoPlist\n ? generateInfoPlistFragment(ir)\n : undefined;\n const entitlementsFragment = options.emitEntitlements\n ? generateEntitlementsFragment(ir)\n : undefined;\n\n // 6. Build output\n const intentFileName = `${ir.name}Intent.swift`;\n const outputPath = options.outDir\n ? `${options.outDir}/${intentFileName}`\n : intentFileName;\n\n return {\n success: true,\n output: {\n outputPath,\n swiftCode,\n infoPlistFragment,\n entitlementsFragment,\n ir,\n diagnostics,\n },\n diagnostics,\n };\n}\n","/**\n * Axint Parser\n *\n * Parses TypeScript intent definitions (using the defineIntent() API)\n * into the Axint Intermediate Representation (IR).\n *\n * Approach: Real TypeScript compiler API AST walker. We create a\n * SourceFile, find defineIntent() CallExpressions, and extract the\n * ObjectLiteralExpression properties using the actual TS AST.\n *\n * The previous v0.1.x parser used regex matching. That approach was\n * replaced in v0.2.0 to support enums, arrays, entities, and accurate\n * return-type inference.\n */\n\nimport ts from \"typescript\";\nimport type {\n IRIntent,\n IRParameter,\n IRType,\n IRPrimitiveType,\n} from \"./types.js\";\nimport { PARAM_TYPES, LEGACY_PARAM_ALIASES } from \"./types.js\";\n\n/**\n * Parse a TypeScript source file containing a defineIntent() call\n * and return the IR representation.\n */\nexport function parseIntentSource(\n source: string,\n filePath: string = \"<stdin>\"\n): IRIntent {\n const sourceFile = ts.createSourceFile(\n filePath,\n source,\n ts.ScriptTarget.Latest,\n true, // setParentNodes\n ts.ScriptKind.TS\n );\n\n const defineIntentCall = findDefineIntentCall(sourceFile);\n if (!defineIntentCall) {\n throw new ParserError(\n \"AX001\",\n `No defineIntent() call found in ${filePath}`,\n filePath,\n undefined,\n \"Ensure your file contains a `defineIntent({ ... })` call.\"\n );\n }\n\n const arg = defineIntentCall.arguments[0];\n if (!arg || !ts.isObjectLiteralExpression(arg)) {\n throw new ParserError(\n \"AX001\",\n \"defineIntent() must be called with an object literal\",\n filePath,\n posOf(sourceFile, defineIntentCall),\n \"Pass an object: defineIntent({ name, title, description, params, perform })\"\n );\n }\n\n const props = propertyMap(arg);\n\n const name = readStringLiteral(props.get(\"name\"));\n const title = readStringLiteral(props.get(\"title\"));\n const description = readStringLiteral(props.get(\"description\"));\n const domain = readStringLiteral(props.get(\"domain\"));\n const category = readStringLiteral(props.get(\"category\"));\n const isDiscoverable = readBooleanLiteral(props.get(\"isDiscoverable\"));\n\n if (!name) {\n throw new ParserError(\n \"AX002\",\n \"Missing required field: name\",\n filePath,\n posOf(sourceFile, arg),\n 'Add a name field: name: \"MyIntent\"'\n );\n }\n if (!title) {\n throw new ParserError(\n \"AX003\",\n \"Missing required field: title\",\n filePath,\n posOf(sourceFile, arg),\n 'Add a title field: title: \"My Intent Title\"'\n );\n }\n if (!description) {\n throw new ParserError(\n \"AX004\",\n \"Missing required field: description\",\n filePath,\n posOf(sourceFile, arg),\n 'Add a description field: description: \"What this intent does\"'\n );\n }\n\n const paramsNode = props.get(\"params\");\n const parameters: IRParameter[] = paramsNode\n ? extractParameters(paramsNode, filePath, sourceFile)\n : [];\n\n // Return-type inference from the perform() function signature.\n const performNode = props.get(\"perform\");\n const returnType = inferReturnType(performNode);\n\n // Entitlements (optional array of strings)\n const entitlementsNode = props.get(\"entitlements\");\n const entitlements = readStringArray(entitlementsNode);\n\n // Info.plist keys (optional object literal of { key: \"description\" })\n const infoPlistNode = props.get(\"infoPlistKeys\");\n const infoPlistKeys = readStringRecord(infoPlistNode);\n\n return {\n name,\n title,\n description,\n domain: domain || undefined,\n category: category || undefined,\n parameters,\n returnType,\n sourceFile: filePath,\n entitlements: entitlements.length > 0 ? entitlements : undefined,\n infoPlistKeys:\n Object.keys(infoPlistKeys).length > 0 ? infoPlistKeys : undefined,\n isDiscoverable: isDiscoverable ?? undefined,\n };\n}\n\n// ─── AST Walkers ─────────────────────────────────────────────────────\n\nfunction findDefineIntentCall(\n node: ts.Node\n): ts.CallExpression | undefined {\n let found: ts.CallExpression | undefined;\n const visit = (n: ts.Node): void => {\n if (found) return;\n if (\n ts.isCallExpression(n) &&\n ts.isIdentifier(n.expression) &&\n n.expression.text === \"defineIntent\"\n ) {\n found = n;\n return;\n }\n ts.forEachChild(n, visit);\n };\n visit(node);\n return found;\n}\n\nfunction propertyMap(\n obj: ts.ObjectLiteralExpression\n): Map<string, ts.Expression> {\n const map = new Map<string, ts.Expression>();\n for (const prop of obj.properties) {\n if (ts.isPropertyAssignment(prop)) {\n const key = propertyKeyName(prop.name);\n if (key) map.set(key, prop.initializer);\n } else if (ts.isShorthandPropertyAssignment(prop)) {\n map.set(prop.name.text, prop.name);\n } else if (ts.isMethodDeclaration(prop)) {\n const key = propertyKeyName(prop.name);\n if (key) map.set(key, prop as unknown as ts.Expression);\n }\n }\n return map;\n}\n\nfunction propertyKeyName(name: ts.PropertyName): string | undefined {\n if (ts.isIdentifier(name)) return name.text;\n if (ts.isStringLiteral(name)) return name.text;\n if (ts.isNumericLiteral(name)) return name.text;\n return undefined;\n}\n\nfunction readStringLiteral(node: ts.Expression | undefined): string | null {\n if (!node) return null;\n if (ts.isStringLiteral(node)) return node.text;\n if (ts.isNoSubstitutionTemplateLiteral(node)) return node.text;\n return null;\n}\n\nfunction readBooleanLiteral(\n node: ts.Expression | undefined\n): boolean | undefined {\n if (!node) return undefined;\n if (node.kind === ts.SyntaxKind.TrueKeyword) return true;\n if (node.kind === ts.SyntaxKind.FalseKeyword) return false;\n return undefined;\n}\n\nfunction readStringArray(node: ts.Expression | undefined): string[] {\n if (!node || !ts.isArrayLiteralExpression(node)) return [];\n const out: string[] = [];\n for (const el of node.elements) {\n const s = readStringLiteral(el);\n if (s !== null) out.push(s);\n }\n return out;\n}\n\nfunction readStringRecord(\n node: ts.Expression | undefined\n): Record<string, string> {\n if (!node || !ts.isObjectLiteralExpression(node)) return {};\n const rec: Record<string, string> = {};\n for (const prop of node.properties) {\n if (!ts.isPropertyAssignment(prop)) continue;\n const key = propertyKeyName(prop.name);\n const val = readStringLiteral(prop.initializer);\n if (key && val !== null) rec[key] = val;\n }\n return rec;\n}\n\n// ─── Parameter Extraction ────────────────────────────────────────────\n\nfunction extractParameters(\n node: ts.Expression,\n filePath: string,\n sourceFile: ts.SourceFile\n): IRParameter[] {\n if (!ts.isObjectLiteralExpression(node)) {\n throw new ParserError(\n \"AX006\",\n \"`params` must be an object literal\",\n filePath,\n posOf(sourceFile, node),\n \"Use params: { name: param.string(...), ... }\"\n );\n }\n\n const params: IRParameter[] = [];\n for (const prop of node.properties) {\n if (!ts.isPropertyAssignment(prop)) continue;\n const paramName = propertyKeyName(prop.name);\n if (!paramName) continue;\n\n const { typeName, description, configObject } = extractParamCall(\n prop.initializer,\n filePath,\n sourceFile\n );\n\n const resolvedType = resolveParamType(typeName, filePath, sourceFile, prop);\n\n const isOptional = configObject\n ? readBooleanLiteral(configObject.get(\"required\")) === false\n : false;\n\n const defaultExpr = configObject?.get(\"default\");\n const defaultValue = defaultExpr ? evaluateLiteral(defaultExpr) : undefined;\n\n const titleFromConfig = configObject\n ? readStringLiteral(configObject.get(\"title\"))\n : null;\n\n const irType: IRType = isOptional\n ? {\n kind: \"optional\",\n innerType: { kind: \"primitive\", value: resolvedType },\n }\n : { kind: \"primitive\", value: resolvedType };\n\n params.push({\n name: paramName,\n type: irType,\n title: titleFromConfig || prettyTitle(paramName),\n description,\n isOptional,\n defaultValue,\n });\n }\n\n return params;\n}\n\ninterface ParamCallInfo {\n typeName: string;\n description: string;\n configObject: Map<string, ts.Expression> | null;\n}\n\nfunction extractParamCall(\n expr: ts.Expression,\n filePath: string,\n sourceFile: ts.SourceFile\n): ParamCallInfo {\n if (!ts.isCallExpression(expr)) {\n throw new ParserError(\n \"AX007\",\n \"Parameter value must be a call to a param.* helper\",\n filePath,\n posOf(sourceFile, expr),\n \"Use param.string(...), param.int(...), param.date(...), etc.\"\n );\n }\n\n // Expect: param.<type>(description, config?)\n if (\n !ts.isPropertyAccessExpression(expr.expression) ||\n !ts.isIdentifier(expr.expression.expression) ||\n expr.expression.expression.text !== \"param\"\n ) {\n throw new ParserError(\n \"AX007\",\n \"Parameter value must be a call to a param.* helper\",\n filePath,\n posOf(sourceFile, expr),\n \"Use param.string(...), param.int(...), param.date(...), etc.\"\n );\n }\n\n const typeName = expr.expression.name.text;\n const descriptionArg = expr.arguments[0];\n const configArg = expr.arguments[1];\n\n const description = descriptionArg ? readStringLiteral(descriptionArg) : null;\n if (description === null) {\n throw new ParserError(\n \"AX008\",\n `param.${typeName}() requires a string description as the first argument`,\n filePath,\n posOf(sourceFile, expr),\n `Example: param.${typeName}(\"Human-readable description\")`\n );\n }\n\n const configObject =\n configArg && ts.isObjectLiteralExpression(configArg)\n ? propertyMap(configArg)\n : null;\n\n return { typeName, description, configObject };\n}\n\nfunction resolveParamType(\n typeName: string,\n filePath: string,\n sourceFile: ts.SourceFile,\n node: ts.Node\n): IRPrimitiveType {\n if (PARAM_TYPES.has(typeName as IRPrimitiveType)) {\n return typeName as IRPrimitiveType;\n }\n if (typeName in LEGACY_PARAM_ALIASES) {\n return LEGACY_PARAM_ALIASES[typeName];\n }\n throw new ParserError(\n \"AX005\",\n `Unknown param type: param.${typeName}`,\n filePath,\n posOf(sourceFile, node),\n `Supported types: ${[...PARAM_TYPES].join(\", \")}`\n );\n}\n\n// ─── Literal Evaluation ──────────────────────────────────────────────\n\nfunction evaluateLiteral(node: ts.Expression): unknown {\n if (ts.isStringLiteral(node)) return node.text;\n if (ts.isNoSubstitutionTemplateLiteral(node)) return node.text;\n if (ts.isNumericLiteral(node)) return Number(node.text);\n if (node.kind === ts.SyntaxKind.TrueKeyword) return true;\n if (node.kind === ts.SyntaxKind.FalseKeyword) return false;\n if (node.kind === ts.SyntaxKind.NullKeyword) return null;\n if (\n ts.isPrefixUnaryExpression(node) &&\n node.operator === ts.SyntaxKind.MinusToken &&\n ts.isNumericLiteral(node.operand)\n ) {\n return -Number(node.operand.text);\n }\n return undefined;\n}\n\n// ─── Return-Type Inference ───────────────────────────────────────────\n\nfunction inferReturnType(performNode: ts.Expression | undefined): IRType {\n // Default when we can't infer anything.\n const defaultType: IRType = { kind: \"primitive\", value: \"string\" };\n if (!performNode) return defaultType;\n\n // Handle method shorthand: perform() { ... }\n if (ts.isMethodDeclaration(performNode)) {\n return inferFromReturnStatements(performNode.body);\n }\n\n // Handle arrow function: perform: async () => { ... }\n if (ts.isArrowFunction(performNode)) {\n if (performNode.body && ts.isBlock(performNode.body)) {\n return inferFromReturnStatements(performNode.body);\n }\n // Single-expression arrow: perform: async (p) => \"literal\"\n return inferFromExpression(performNode.body as ts.Expression);\n }\n\n // Handle function expression: perform: async function() { ... }\n if (ts.isFunctionExpression(performNode)) {\n return inferFromReturnStatements(performNode.body);\n }\n\n return defaultType;\n}\n\nfunction inferFromReturnStatements(block: ts.Block | undefined): IRType {\n const defaultType: IRType = { kind: \"primitive\", value: \"string\" };\n if (!block) return defaultType;\n\n let inferred: IRType | undefined;\n const visit = (n: ts.Node): void => {\n if (inferred) return;\n if (ts.isReturnStatement(n) && n.expression) {\n inferred = inferFromExpression(n.expression);\n return;\n }\n // Don't walk into nested functions — only the top-level perform() body.\n if (\n ts.isFunctionDeclaration(n) ||\n ts.isFunctionExpression(n) ||\n ts.isArrowFunction(n)\n ) {\n return;\n }\n ts.forEachChild(n, visit);\n };\n visit(block);\n return inferred ?? defaultType;\n}\n\nfunction inferFromExpression(expr: ts.Expression): IRType {\n if (ts.isStringLiteral(expr) || ts.isNoSubstitutionTemplateLiteral(expr)) {\n return { kind: \"primitive\", value: \"string\" };\n }\n if (ts.isNumericLiteral(expr)) {\n return expr.text.includes(\".\")\n ? { kind: \"primitive\", value: \"double\" }\n : { kind: \"primitive\", value: \"int\" };\n }\n if (\n expr.kind === ts.SyntaxKind.TrueKeyword ||\n expr.kind === ts.SyntaxKind.FalseKeyword\n ) {\n return { kind: \"primitive\", value: \"boolean\" };\n }\n // Default fallback\n return { kind: \"primitive\", value: \"string\" };\n}\n\n// ─── Helpers ─────────────────────────────────────────────────────────\n\nfunction prettyTitle(name: string): string {\n const spaced = name.replace(/([A-Z])/g, \" $1\").trim();\n return spaced.charAt(0).toUpperCase() + spaced.slice(1);\n}\n\nfunction posOf(\n sourceFile: ts.SourceFile,\n node: ts.Node\n): number | undefined {\n try {\n const { line } = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n return line + 1;\n } catch {\n return undefined;\n }\n}\n\n// ─── Error Class ─────────────────────────────────────────────────────\n\nexport class ParserError extends Error {\n constructor(\n public code: string,\n message: string,\n public file: string,\n public line?: number,\n public suggestion?: string\n ) {\n super(message);\n this.name = \"ParserError\";\n }\n\n format(): string {\n let output = `\\n error[${this.code}]: ${this.message}\\n`;\n if (this.file) output += ` --> ${this.file}`;\n if (this.line) output += `:${this.line}`;\n output += \"\\n\";\n if (this.suggestion) {\n output += ` = help: ${this.suggestion}\\n`;\n }\n return output;\n }\n}\n","/**\n * Axint Core Types\n *\n * Intermediate Representation (IR) and compiler types for the\n * TypeScript → Swift App Intent compilation pipeline.\n */\n\n// ─── IR Types ────────────────────────────────────────────────────────\n\n/** Primitive types supported by App Intents */\nexport type IRPrimitiveType =\n | \"string\"\n | \"int\"\n | \"double\"\n | \"float\"\n | \"boolean\"\n | \"date\"\n | \"duration\"\n | \"url\";\n\n/** Type node in the IR */\nexport type IRType =\n | { kind: \"primitive\"; value: IRPrimitiveType }\n | { kind: \"array\"; elementType: IRType }\n | { kind: \"optional\"; innerType: IRType }\n | { kind: \"entity\"; entityName: string; properties: IRParameter[] }\n | { kind: \"enum\"; name: string; cases: string[] };\n\n/** A single parameter in an intent definition */\nexport interface IRParameter {\n name: string;\n type: IRType;\n title: string;\n description: string;\n isOptional: boolean;\n defaultValue?: unknown;\n}\n\n/** The main IR node representing a compiled intent */\nexport interface IRIntent {\n name: string;\n title: string;\n description: string;\n domain?: string;\n category?: string;\n parameters: IRParameter[];\n returnType: IRType;\n sourceFile: string;\n /** Entitlements required by this intent (e.g., \"com.apple.developer.siri\") */\n entitlements?: string[];\n /** Info.plist keys required by this intent (e.g., \"NSCalendarsUsageDescription\") */\n infoPlistKeys?: Record<string, string>;\n /** Whether the intent should be exposed to Spotlight indexing */\n isDiscoverable?: boolean;\n}\n\n// ─── Compiler Types ──────────────────────────────────────────────────\n\nexport interface CompilerOptions {\n /** Output directory for generated Swift files */\n outDir: string;\n /** Whether to run validation after generation */\n validate?: boolean;\n /** Target iOS/macOS version */\n target?: \"ios16\" | \"ios17\" | \"ios18\" | \"ios26\" | \"macos13\" | \"macos14\" | \"macos15\" | \"macos26\";\n /** Whether to emit an Info.plist fragment alongside the Swift file */\n emitInfoPlist?: boolean;\n /** Whether to emit an entitlements fragment alongside the Swift file */\n emitEntitlements?: boolean;\n /** Whether to run swift-format on the output (requires swift-format on PATH) */\n format?: boolean;\n}\n\nexport interface CompilerOutput {\n /** Path to the generated Swift file */\n outputPath: string;\n /** The generated Swift source code */\n swiftCode: string;\n /** Info.plist fragment (if emitInfoPlist is true) */\n infoPlistFragment?: string;\n /** Entitlements fragment (if emitEntitlements is true) */\n entitlementsFragment?: string;\n /** The intermediate representation */\n ir: IRIntent;\n /** Validation diagnostics */\n diagnostics: Diagnostic[];\n}\n\n// ─── Diagnostics ─────────────────────────────────────────────────────\n\nexport type DiagnosticSeverity = \"error\" | \"warning\" | \"info\";\n\nexport interface Diagnostic {\n code: string;\n severity: DiagnosticSeverity;\n message: string;\n file?: string;\n line?: number;\n column?: number;\n suggestion?: string;\n}\n\n// ─── Param Type Registry ─────────────────────────────────────────────\n\n/**\n * Canonical set of supported param types.\n * Single source of truth — parser, SDK, and docs all derive from this.\n * To add a new type: add it to IRPrimitiveType, PARAM_TYPES, and SWIFT_TYPE_MAP.\n */\nexport const PARAM_TYPES: ReadonlySet<IRPrimitiveType> = new Set<IRPrimitiveType>([\n \"string\",\n \"int\",\n \"double\",\n \"float\",\n \"boolean\",\n \"date\",\n \"duration\",\n \"url\",\n]);\n\n/**\n * Legacy alias: \"number\" → \"int\" for backwards compatibility with v0.1.x files.\n * Parser will accept \"number\" and rewrite it to \"int\" with a deprecation warning.\n */\nexport const LEGACY_PARAM_ALIASES: Record<string, IRPrimitiveType> = {\n number: \"int\",\n};\n\n// ─── Swift Type Mapping ──────────────────────────────────────────────\n\nexport const SWIFT_TYPE_MAP: Record<IRPrimitiveType, string> = {\n string: \"String\",\n int: \"Int\",\n double: \"Double\",\n float: \"Float\",\n boolean: \"Bool\",\n date: \"Date\",\n duration: \"Measurement<UnitDuration>\",\n url: \"URL\",\n};\n\n/**\n * Convert an IRType to its Swift type string.\n */\nexport function irTypeToSwift(type: IRType): string {\n switch (type.kind) {\n case \"primitive\":\n return SWIFT_TYPE_MAP[type.value];\n case \"array\":\n return `[${irTypeToSwift(type.elementType)}]`;\n case \"optional\":\n return `${irTypeToSwift(type.innerType)}?`;\n case \"entity\":\n return type.entityName;\n case \"enum\":\n return type.name;\n }\n}\n","/**\n * Axint Swift Code Generator\n *\n * Transforms the IR into clean, idiomatic Swift App Intent source code.\n * Uses string templates for readability and maintainability.\n *\n * In addition to the primary Swift file, this module can emit two\n * companion fragments:\n * - an Info.plist XML fragment, listing the keys the intent requires\n * - an .entitlements XML fragment, listing the entitlements the\n * intent requires\n *\n * Both fragments are designed to be merged into the host Xcode project\n * by the user (or a future axint-link command).\n */\n\nimport type { IRIntent, IRParameter, IRType } from \"./types.js\";\nimport { irTypeToSwift } from \"./types.js\";\n\n// ─── String Escaping ─────────────────────────────────────────────────\n\n/**\n * Escape a string for safe interpolation into Swift string literals.\n * Prevents code injection via user-controlled titles/descriptions.\n */\nexport function escapeSwiftString(s: string): string {\n return s\n .replace(/\\\\/g, \"\\\\\\\\\")\n .replace(/\"/g, '\\\\\"')\n .replace(/\\n/g, \"\\\\n\")\n .replace(/\\r/g, \"\\\\r\")\n .replace(/\\t/g, \"\\\\t\");\n}\n\n/**\n * Escape a string for safe interpolation into XML (Info.plist or\n * .entitlements). Plist XML uses the same rules as general XML.\n */\nexport function escapeXml(s: string): string {\n return s\n .replace(/&/g, \"&amp;\")\n .replace(/</g, \"&lt;\")\n .replace(/>/g, \"&gt;\")\n .replace(/\"/g, \"&quot;\")\n .replace(/'/g, \"&apos;\");\n}\n\n// ─── Primary Swift Generator ─────────────────────────────────────────\n\n/**\n * Generate a Swift App Intent source file from an IR intent.\n */\nexport function generateSwift(intent: IRIntent): string {\n const lines: string[] = [];\n\n // File header\n lines.push(`// ${intent.name}Intent.swift`);\n lines.push(`// Generated by Axint — https://github.com/agenticempire/axint`);\n lines.push(`// Do not edit manually. Re-run \\`axint compile\\` to regenerate.`);\n lines.push(``);\n lines.push(`import AppIntents`);\n lines.push(`import Foundation`);\n lines.push(``);\n\n // Struct declaration\n lines.push(`struct ${intent.name}Intent: AppIntent {`);\n\n // Static metadata\n lines.push(\n ` static let title: LocalizedStringResource = \"${escapeSwiftString(intent.title)}\"`\n );\n lines.push(\n ` static let description: IntentDescription = IntentDescription(\"${escapeSwiftString(intent.description)}\")`\n );\n if (intent.isDiscoverable !== undefined) {\n lines.push(` static let isDiscoverable: Bool = ${intent.isDiscoverable}`);\n }\n lines.push(``);\n\n // Parameters\n for (const param of intent.parameters) {\n lines.push(generateParameter(param));\n }\n\n if (intent.parameters.length > 0) {\n lines.push(``);\n }\n\n // Perform function with return-type aware signature\n const returnTypeSignature = generateReturnSignature(intent.returnType);\n lines.push(` func perform() async throws -> ${returnTypeSignature} {`);\n lines.push(` // TODO: Implement your intent logic here.`);\n\n if (intent.parameters.length > 0) {\n const paramList = intent.parameters.map((p) => `\\\\(${p.name})`).join(\", \");\n lines.push(` // Parameters available: ${paramList}`);\n }\n\n lines.push(generatePerformReturn(intent.returnType));\n lines.push(` }`);\n lines.push(`}`);\n lines.push(``);\n\n return lines.join(\"\\n\");\n}\n\n// ─── Info.plist Fragment Generator ───────────────────────────────────\n\n/**\n * Generate an Info.plist XML fragment from the intent's declared keys.\n * Returns `undefined` if the intent declares no Info.plist keys.\n *\n * The fragment is a bare `<dict>`-less sequence of `<key>…</key>` /\n * `<string>…</string>` pairs, ready to be merged into an existing\n * Info.plist. A commented header identifies the source intent so users\n * can audit provenance.\n */\nexport function generateInfoPlistFragment(intent: IRIntent): string | undefined {\n const keys = intent.infoPlistKeys;\n if (!keys || Object.keys(keys).length === 0) return undefined;\n\n const lines: string[] = [];\n lines.push(`<?xml version=\"1.0\" encoding=\"UTF-8\"?>`);\n lines.push(\n `<!-- Info.plist fragment generated by Axint for ${intent.name}Intent -->`\n );\n lines.push(`<!-- Merge these keys into your app's Info.plist. -->`);\n lines.push(`<plist version=\"1.0\">`);\n lines.push(`<dict>`);\n for (const [key, desc] of Object.entries(keys)) {\n lines.push(` <key>${escapeXml(key)}</key>`);\n lines.push(` <string>${escapeXml(desc)}</string>`);\n }\n lines.push(`</dict>`);\n lines.push(`</plist>`);\n lines.push(``);\n\n return lines.join(\"\\n\");\n}\n\n// ─── Entitlements Fragment Generator ─────────────────────────────────\n\n/**\n * Generate a `.entitlements` XML fragment from the intent's declared\n * entitlements. Returns `undefined` if the intent declares none.\n *\n * Axint only knows the entitlement identifiers, so all entries are\n * emitted as `<true/>` boolean entitlements. If an entitlement requires\n * a typed value (string, array), users must edit the fragment after\n * generation — a TODO comment is emitted to flag this.\n */\nexport function generateEntitlementsFragment(\n intent: IRIntent\n): string | undefined {\n const ents = intent.entitlements;\n if (!ents || ents.length === 0) return undefined;\n\n const lines: string[] = [];\n lines.push(`<?xml version=\"1.0\" encoding=\"UTF-8\"?>`);\n lines.push(\n `<!-- Entitlements fragment generated by Axint for ${intent.name}Intent -->`\n );\n lines.push(`<!-- Merge these into your target's .entitlements file. -->`);\n lines.push(`<!-- Note: entitlements requiring typed values (string/array) -->`);\n lines.push(`<!-- need manual adjustment — defaults below are boolean true. -->`);\n lines.push(\n `<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">`\n );\n lines.push(`<plist version=\"1.0\">`);\n lines.push(`<dict>`);\n for (const ent of ents) {\n lines.push(` <key>${escapeXml(ent)}</key>`);\n lines.push(` <true/>`);\n }\n lines.push(`</dict>`);\n lines.push(`</plist>`);\n lines.push(``);\n\n return lines.join(\"\\n\");\n}\n\n// ─── Helpers ─────────────────────────────────────────────────────────\n\nfunction generateParameter(param: IRParameter): string {\n const swiftType = irTypeToSwift(param.type);\n const lines: string[] = [];\n\n // Build @Parameter decorator\n const attrs: string[] = [];\n attrs.push(`title: \"${escapeSwiftString(param.title)}\"`);\n if (param.description) {\n attrs.push(`description: \"${escapeSwiftString(param.description)}\"`);\n }\n\n const decorator = ` @Parameter(${attrs.join(\", \")})`;\n lines.push(decorator);\n\n // Property declaration\n if (param.defaultValue !== undefined) {\n const defaultStr = formatSwiftDefault(param.defaultValue, param.type);\n lines.push(` var ${param.name}: ${swiftType} = ${defaultStr}`);\n } else {\n lines.push(` var ${param.name}: ${swiftType}`);\n }\n\n lines.push(``);\n\n return lines.join(\"\\n\");\n}\n\n/**\n * Choose the Swift return-type signature for the generated perform().\n * We map the inferred IR return type to an App Intents `IntentResult`\n * shape. For primitive return types we use `some ReturnsValue<T>`;\n * otherwise we fall back to `some IntentResult`.\n */\nfunction generateReturnSignature(type: IRType): string {\n if (type.kind === \"primitive\") {\n const swift = irTypeToSwift(type);\n return `some IntentResult & ReturnsValue<${swift}>`;\n }\n if (type.kind === \"optional\" && type.innerType.kind === \"primitive\") {\n const swift = irTypeToSwift(type.innerType);\n return `some IntentResult & ReturnsValue<${swift}>`;\n }\n return `some IntentResult`;\n}\n\n/**\n * Emit the `return .result(...)` line that matches the return signature\n * produced by `generateReturnSignature`. When the return type is a\n * primitive we return a well-typed default placeholder the user can\n * replace; otherwise we emit a plain `.result()`.\n */\nfunction generatePerformReturn(type: IRType): string {\n const indent = \" \";\n if (type.kind === \"primitive\") {\n return `${indent}return .result(value: ${defaultLiteralFor(type.value)})`;\n }\n if (type.kind === \"optional\" && type.innerType.kind === \"primitive\") {\n return `${indent}return .result(value: ${defaultLiteralFor(type.innerType.value)})`;\n }\n return `${indent}return .result()`;\n}\n\nfunction defaultLiteralFor(primitive: string): string {\n switch (primitive) {\n case \"string\":\n return `\"\"`;\n case \"int\":\n return `0`;\n case \"double\":\n return `0.0`;\n case \"float\":\n return `Float(0)`;\n case \"boolean\":\n return `false`;\n case \"date\":\n return `Date()`;\n case \"duration\":\n return `Measurement<UnitDuration>(value: 0, unit: .seconds)`;\n case \"url\":\n return `URL(string: \"about:blank\")!`;\n default:\n return `\"\"`;\n }\n}\n\nfunction formatSwiftDefault(value: unknown, _type: IRType): string {\n if (typeof value === \"string\") return `\"${escapeSwiftString(value)}\"`;\n if (typeof value === \"number\") {\n if (!Number.isFinite(value)) return `0`; // Guard against NaN/Infinity\n return `${value}`;\n }\n if (typeof value === \"boolean\") return value ? \"true\" : \"false\";\n return `\"${escapeSwiftString(String(value))}\"`; // Safe fallback\n}\n","/**\n * Axint Validator\n *\n * Validates generated Swift App Intent code against Apple's API surface.\n * Returns diagnostics with error codes, locations, and fix suggestions.\n */\n\nimport type { Diagnostic, IRIntent } from \"./types.js\";\n\n/** Apple-recommended maximum parameters per intent for usability */\nconst MAX_PARAMETERS = 10;\n\n/** Maximum title length before Siri may truncate display */\nconst MAX_TITLE_LENGTH = 60;\n\n/**\n * Validate an IR intent for App Intents framework compliance.\n */\nexport function validateIntent(intent: IRIntent): Diagnostic[] {\n const diagnostics: Diagnostic[] = [];\n\n // Rule: Intent name must be PascalCase and non-empty\n if (!intent.name || !/^[A-Z][a-zA-Z0-9]*$/.test(intent.name)) {\n diagnostics.push({\n code: \"AX100\",\n severity: \"error\",\n message: `Intent name \"${intent.name}\" must be PascalCase (e.g., \"CreateEvent\")`,\n file: intent.sourceFile,\n suggestion: `Rename to \"${toPascalCase(intent.name)}\"`,\n });\n }\n\n // Rule: Title must not be empty\n if (!intent.title || intent.title.trim().length === 0) {\n diagnostics.push({\n code: \"AX101\",\n severity: \"error\",\n message: \"Intent title must not be empty\",\n file: intent.sourceFile,\n suggestion: \"Add a human-readable title for Siri and Shortcuts display\",\n });\n }\n\n // Rule: Description must not be empty\n if (!intent.description || intent.description.trim().length === 0) {\n diagnostics.push({\n code: \"AX102\",\n severity: \"error\",\n message: \"Intent description must not be empty\",\n file: intent.sourceFile,\n suggestion: \"Add a description explaining what this intent does\",\n });\n }\n\n // Rule: Parameter names must be valid Swift identifiers\n for (const param of intent.parameters) {\n if (!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(param.name)) {\n diagnostics.push({\n code: \"AX103\",\n severity: \"error\",\n message: `Parameter name \"${param.name}\" is not a valid Swift identifier`,\n file: intent.sourceFile,\n suggestion: `Rename to \"${param.name.replace(/[^a-zA-Z0-9_]/g, \"_\")}\"`,\n });\n }\n\n // Rule: Parameter description should not be empty\n if (!param.description || param.description.trim().length === 0) {\n diagnostics.push({\n code: \"AX104\",\n severity: \"warning\",\n message: `Parameter \"${param.name}\" has no description — Siri will display it without context`,\n file: intent.sourceFile,\n suggestion: \"Add a description for better Siri/Shortcuts display\",\n });\n }\n }\n\n // Rule: Max 10 parameters per intent (App Intents recommendation)\n if (intent.parameters.length > MAX_PARAMETERS) {\n diagnostics.push({\n code: \"AX105\",\n severity: \"warning\",\n message: `Intent has ${intent.parameters.length} parameters. Apple recommends ${MAX_PARAMETERS} or fewer for usability.`,\n file: intent.sourceFile,\n suggestion:\n \"Consider splitting into multiple intents or grouping parameters into an entity\",\n });\n }\n\n // Rule: Title should not exceed 60 characters (Siri display constraint)\n if (intent.title && intent.title.length > MAX_TITLE_LENGTH) {\n diagnostics.push({\n code: \"AX106\",\n severity: \"warning\",\n message: `Intent title is ${intent.title.length} characters. Siri display may truncate titles over ${MAX_TITLE_LENGTH} characters.`,\n file: intent.sourceFile,\n });\n }\n\n // Rule: Parameter names must be unique within an intent\n const seen = new Set<string>();\n for (const param of intent.parameters) {\n if (seen.has(param.name)) {\n diagnostics.push({\n code: \"AX107\",\n severity: \"error\",\n message: `Duplicate parameter name \"${param.name}\"`,\n file: intent.sourceFile,\n suggestion: \"Each parameter in a single intent must have a unique name\",\n });\n }\n seen.add(param.name);\n }\n\n // Rule: Entitlement strings must look like reverse-DNS identifiers\n for (const ent of intent.entitlements ?? []) {\n if (!/^[a-zA-Z0-9._-]+$/.test(ent) || !ent.includes(\".\")) {\n diagnostics.push({\n code: \"AX108\",\n severity: \"warning\",\n message: `Entitlement \"${ent}\" does not look like a valid reverse-DNS identifier`,\n file: intent.sourceFile,\n suggestion:\n 'Use reverse-DNS, e.g., \"com.apple.developer.siri\" or \"com.apple.security.app-sandbox\"',\n });\n }\n }\n\n // Rule: Info.plist keys must start with \"NS\" or other known prefixes\n for (const key of Object.keys(intent.infoPlistKeys ?? {})) {\n if (!/^(NS|UI|LS|CF|CA|CK)[A-Za-z0-9]+$/.test(key)) {\n diagnostics.push({\n code: \"AX109\",\n severity: \"warning\",\n message: `Info.plist key \"${key}\" does not match Apple's usual naming conventions`,\n file: intent.sourceFile,\n suggestion:\n 'Apple keys generally start with \"NS\" (e.g., \"NSCalendarsUsageDescription\")',\n });\n }\n }\n\n return diagnostics;\n}\n\n/**\n * Validate generated Swift source code for basic correctness.\n */\nexport function validateSwiftSource(swift: string): Diagnostic[] {\n const diagnostics: Diagnostic[] = [];\n\n // Check for required import\n if (!swift.includes(\"import AppIntents\")) {\n diagnostics.push({\n code: \"AX200\",\n severity: \"error\",\n message: 'Generated Swift is missing \"import AppIntents\"',\n });\n }\n\n // Check for AppIntent conformance\n if (!swift.includes(\": AppIntent\")) {\n diagnostics.push({\n code: \"AX201\",\n severity: \"error\",\n message: \"Generated struct does not conform to AppIntent protocol\",\n });\n }\n\n // Check for perform function\n if (!swift.includes(\"func perform()\")) {\n diagnostics.push({\n code: \"AX202\",\n severity: \"error\",\n message: \"Generated struct is missing the perform() function\",\n });\n }\n\n return diagnostics;\n}\n\n// ─── Helpers ─────────────────────────────────────────────────────────\n\nfunction toPascalCase(s: string): string {\n if (!s) return \"UnnamedIntent\";\n return s\n .replace(/[-_\\s]+(.)?/g, (_, c) => (c ? c.toUpperCase() : \"\"))\n .replace(/^(.)/, (c) => c.toUpperCase());\n}\n"],"mappings":";AAaA,SAAS,oBAAoB;;;ACE7B,OAAO,QAAQ;;;AC8FR,IAAM,cAA4C,oBAAI,IAAqB;AAAA,EAChF;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAMM,IAAM,uBAAwD;AAAA,EACnE,QAAQ;AACV;AAIO,IAAM,iBAAkD;AAAA,EAC7D,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AAAA,EACN,UAAU;AAAA,EACV,KAAK;AACP;AAKO,SAAS,cAAc,MAAsB;AAClD,UAAQ,KAAK,MAAM;AAAA,IACjB,KAAK;AACH,aAAO,eAAe,KAAK,KAAK;AAAA,IAClC,KAAK;AACH,aAAO,IAAI,cAAc,KAAK,WAAW,CAAC;AAAA,IAC5C,KAAK;AACH,aAAO,GAAG,cAAc,KAAK,SAAS,CAAC;AAAA,IACzC,KAAK;AACH,aAAO,KAAK;AAAA,IACd,KAAK;AACH,aAAO,KAAK;AAAA,EAChB;AACF;;;ADjIO,SAAS,kBACd,QACA,WAAmB,WACT;AACV,QAAM,aAAa,GAAG;AAAA,IACpB;AAAA,IACA;A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,IACF;AACA,UAAM;AAAA,EACR;AAGA,QAAM,gBAAgB,eAAe,EAAE;AACvC,cAAY,KAAK,GAAG,aAAa;AAEjC,MAAI,cAAc,KAAK,CAAC,MAAM,EAAE,aAAa,OAAO,GAAG;AACrD,WAAO,EAAE,SAAS,OAAO,YAAY;AAAA,EACvC;AAGA,QAAM,YAAY,cAAc,EAAE;AAGlC,MAAI,QAAQ,aAAa,OAAO;AAC9B,UAAM,mBAAmB,oBAAoB,SAAS;AACtD,gBAAY,KAAK,GAAG,gBAAgB;AAEpC,QAAI,iBAAiB,KAAK,CAAC,MAAM,EAAE,aAAa,OAAO,GAAG;AACxD,aAAO,EAAE,SAAS,OAAO,YAAY;AAAA,IACvC;AAAA,EACF;AAGA,QAAM,oBAAoB,QAAQ,gBAC9B,0BAA0B,EAAE,IAC5B;AACJ,QAAM,uBAAuB,QAAQ,mBACjC,6BAA6B,EAAE,IAC/B;AAGJ,QAAM,iBAAiB,GAAG,GAAG,IAAI;AACjC,QAAM,aAAa,QAAQ,SACvB,GAAG,QAAQ,MAAM,IAAI,cAAc,KACnC;AAEJ,SAAO;AAAA,IACL,SAAS;AAAA,IACT,QAAQ;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Axint MCP Server
3
+ *
4
+ * Exposes Axint capabilities as MCP tools that AI coding assistants
5
+ * (Claude Code, Cursor, Windsurf, Zed, any MCP client) can call
6
+ * automatically.
7
+ *
8
+ * Tools:
9
+ * - axint_scaffold: Generate a starter TypeScript intent file
10
+ * - axint_compile: Compile TypeScript intent → Swift App Intent
11
+ * (optionally with Info.plist and entitlements)
12
+ * - axint_validate: Validate an intent definition without codegen
13
+ * - axint_list_templates: List bundled reference templates
14
+ * - axint_template: Return the source of a specific template
15
+ */
16
+ declare function startMCPServer(): Promise<void>;
17
+
18
+ export { startMCPServer };