workos 0.7.3 → 0.8.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.
Files changed (151) hide show
  1. package/README.md +353 -8
  2. package/dist/bin.js +938 -128
  3. package/dist/bin.js.map +1 -1
  4. package/dist/commands/api-key-mgmt.d.ts +16 -0
  5. package/dist/commands/api-key-mgmt.js +96 -0
  6. package/dist/commands/api-key-mgmt.js.map +1 -0
  7. package/dist/commands/audit-log.d.ts +26 -0
  8. package/dist/commands/audit-log.js +155 -0
  9. package/dist/commands/audit-log.js.map +1 -0
  10. package/dist/commands/config.d.ts +3 -0
  11. package/dist/commands/config.js +54 -0
  12. package/dist/commands/config.js.map +1 -0
  13. package/dist/commands/connection.d.ts +13 -0
  14. package/dist/commands/connection.js +94 -0
  15. package/dist/commands/connection.js.map +1 -0
  16. package/dist/commands/debug-sso.d.ts +1 -0
  17. package/dist/commands/debug-sso.js +78 -0
  18. package/dist/commands/debug-sso.js.map +1 -0
  19. package/dist/commands/debug-sync.d.ts +1 -0
  20. package/dist/commands/debug-sync.js +102 -0
  21. package/dist/commands/debug-sync.js.map +1 -0
  22. package/dist/commands/directory.d.ts +27 -0
  23. package/dist/commands/directory.js +174 -0
  24. package/dist/commands/directory.js.map +1 -0
  25. package/dist/commands/env.js +41 -28
  26. package/dist/commands/env.js.map +1 -1
  27. package/dist/commands/event.d.ts +9 -0
  28. package/dist/commands/event.js +43 -0
  29. package/dist/commands/event.js.map +1 -0
  30. package/dist/commands/feature-flag.d.ts +12 -0
  31. package/dist/commands/feature-flag.js +96 -0
  32. package/dist/commands/feature-flag.js.map +1 -0
  33. package/dist/commands/install-skill.js +3 -5
  34. package/dist/commands/install-skill.js.map +1 -1
  35. package/dist/commands/install.js +13 -20
  36. package/dist/commands/install.js.map +1 -1
  37. package/dist/commands/invitation.d.ts +19 -0
  38. package/dist/commands/invitation.js +94 -0
  39. package/dist/commands/invitation.js.map +1 -0
  40. package/dist/commands/membership.d.ts +20 -0
  41. package/dist/commands/membership.js +129 -0
  42. package/dist/commands/membership.js.map +1 -0
  43. package/dist/commands/onboard-user.d.ts +7 -0
  44. package/dist/commands/onboard-user.js +61 -0
  45. package/dist/commands/onboard-user.js.map +1 -0
  46. package/dist/commands/org-domain.d.ts +4 -0
  47. package/dist/commands/org-domain.js +45 -0
  48. package/dist/commands/org-domain.js.map +1 -0
  49. package/dist/commands/organization.d.ts +1 -5
  50. package/dist/commands/organization.js +34 -73
  51. package/dist/commands/organization.js.map +1 -1
  52. package/dist/commands/permission.d.ts +20 -0
  53. package/dist/commands/permission.js +93 -0
  54. package/dist/commands/permission.js.map +1 -0
  55. package/dist/commands/portal.d.ts +7 -0
  56. package/dist/commands/portal.js +26 -0
  57. package/dist/commands/portal.js.map +1 -0
  58. package/dist/commands/role.d.ts +17 -0
  59. package/dist/commands/role.js +122 -0
  60. package/dist/commands/role.js.map +1 -0
  61. package/dist/commands/seed.d.ts +4 -0
  62. package/dist/commands/seed.js +238 -0
  63. package/dist/commands/seed.js.map +1 -0
  64. package/dist/commands/session.d.ts +8 -0
  65. package/dist/commands/session.js +63 -0
  66. package/dist/commands/session.js.map +1 -0
  67. package/dist/commands/setup-org.d.ts +6 -0
  68. package/dist/commands/setup-org.js +99 -0
  69. package/dist/commands/setup-org.js.map +1 -0
  70. package/dist/commands/user.js +35 -71
  71. package/dist/commands/user.js.map +1 -1
  72. package/dist/commands/vault.d.ts +24 -0
  73. package/dist/commands/vault.js +120 -0
  74. package/dist/commands/vault.js.map +1 -0
  75. package/dist/commands/webhook.d.ts +3 -0
  76. package/dist/commands/webhook.js +73 -0
  77. package/dist/commands/webhook.js.map +1 -0
  78. package/dist/dashboard/components/DiffPanel.js.map +1 -1
  79. package/dist/dashboard/lib/logo-frames.js +1 -1
  80. package/dist/dashboard/lib/logo-frames.js.map +1 -1
  81. package/dist/doctor/checks/dashboard.js.map +1 -1
  82. package/dist/doctor/checks/environment.js.map +1 -1
  83. package/dist/integrations/go/index.js +1 -3
  84. package/dist/integrations/go/index.js.map +1 -1
  85. package/dist/lib/adapters/headless-adapter.d.ts +67 -0
  86. package/dist/lib/adapters/headless-adapter.js +263 -0
  87. package/dist/lib/adapters/headless-adapter.js.map +1 -0
  88. package/dist/lib/adapters/index.d.ts +1 -0
  89. package/dist/lib/adapters/index.js +1 -0
  90. package/dist/lib/adapters/index.js.map +1 -1
  91. package/dist/lib/agent-interface.d.ts +3 -11
  92. package/dist/lib/agent-interface.js +3 -19
  93. package/dist/lib/agent-interface.js.map +1 -1
  94. package/dist/lib/api-error-handler.d.ts +6 -0
  95. package/dist/lib/api-error-handler.js +58 -0
  96. package/dist/lib/api-error-handler.js.map +1 -0
  97. package/dist/lib/api-key.js +5 -1
  98. package/dist/lib/api-key.js.map +1 -1
  99. package/dist/lib/config.js.map +1 -1
  100. package/dist/lib/credential-proxy.js +0 -6
  101. package/dist/lib/credential-proxy.js.map +1 -1
  102. package/dist/lib/device-auth.js +1 -1
  103. package/dist/lib/device-auth.js.map +1 -1
  104. package/dist/lib/ensure-auth.js +25 -4
  105. package/dist/lib/ensure-auth.js.map +1 -1
  106. package/dist/lib/installer-core.d.ts +12 -12
  107. package/dist/lib/run-with-core.js +25 -4
  108. package/dist/lib/run-with-core.js.map +1 -1
  109. package/dist/lib/validation/validator.js +0 -1
  110. package/dist/lib/validation/validator.js.map +1 -1
  111. package/dist/lib/workos-client.d.ts +58 -0
  112. package/dist/lib/workos-client.js +137 -0
  113. package/dist/lib/workos-client.js.map +1 -0
  114. package/dist/run.d.ts +7 -0
  115. package/dist/run.js +5 -2
  116. package/dist/run.js.map +1 -1
  117. package/dist/smoke-test.ts +881 -0
  118. package/dist/steps/run-prettier.js +1 -1
  119. package/dist/steps/run-prettier.js.map +1 -1
  120. package/dist/utils/analytics.d.ts +1 -1
  121. package/dist/utils/analytics.js.map +1 -1
  122. package/dist/utils/clack-utils.js +1 -1
  123. package/dist/utils/clack-utils.js.map +1 -1
  124. package/dist/utils/environment.js +8 -0
  125. package/dist/utils/environment.js.map +1 -1
  126. package/dist/utils/exit-codes.d.ts +22 -0
  127. package/dist/utils/exit-codes.js +30 -0
  128. package/dist/utils/exit-codes.js.map +1 -0
  129. package/dist/utils/help-json.d.ts +45 -0
  130. package/dist/utils/help-json.js +1161 -0
  131. package/dist/utils/help-json.js.map +1 -0
  132. package/dist/utils/ndjson.d.ts +16 -0
  133. package/dist/utils/ndjson.js +18 -0
  134. package/dist/utils/ndjson.js.map +1 -0
  135. package/dist/utils/output.d.ts +40 -0
  136. package/dist/utils/output.js +95 -0
  137. package/dist/utils/output.js.map +1 -0
  138. package/dist/utils/package-manager.js +2 -3
  139. package/dist/utils/package-manager.js.map +1 -1
  140. package/dist/utils/paths.d.ts +5 -0
  141. package/dist/utils/paths.js +18 -0
  142. package/dist/utils/paths.js.map +1 -0
  143. package/dist/utils/register-subcommand.d.ts +7 -0
  144. package/dist/utils/register-subcommand.js +36 -0
  145. package/dist/utils/register-subcommand.js.map +1 -0
  146. package/dist/utils/telemetry-types.d.ts +1 -1
  147. package/dist/utils/telemetry-types.js.map +1 -1
  148. package/dist/utils/types.d.ts +12 -0
  149. package/dist/utils/types.js.map +1 -1
  150. package/package.json +20 -16
  151. package/skills/workos-management/SKILL.md +250 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/integrations/go/index.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,eAAe,E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ACF,4GAA4G;KAC7G,CAAC;IAEF,MAAM,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAEpC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["/* Go integration — auto-discovered by registry */\nimport { existsSync, readFileSync, writeFileSync } from 'node:fs';\nimport { join } from 'node:path';\nimport type { FrameworkConfig } from '../../lib/framework-config.js';\nimport { SPINNER_MESSAGE } from '../../lib/framework-config.js';\nimport type { InstallerOptions } from '../../utils/types.js';\nimport { enableDebugLogs } from '../../utils/debug.js';\nimport { analytics } from '../../utils/analytics.js';\nimport { INSTALLER_INTERACTION_EVENT_NAME } from '../../lib/constants.js';\nimport { initializeAgent, runAgent } from '../../lib/agent-interface.js';\nimport { getOrAskForWorkOSCredentials } from '../../utils/clack-utils.js';\nimport { autoConfigureWorkOSEnvironment } from '../../lib/workos-management.js';\nimport { validateInstallation } from '../../lib/validation/index.js';\nimport { parseEnvFile } from '../../utils/env-parser.js';\n\n/** Default port for Go HTTP servers */\nconst GO_DEFAULT_PORT = 8080;\nconst GO_CALLBACK_PATH = '/auth/callback';\n\n/**\n * Detect whether go.mod includes the Gin web framework.\n */\nfunction detectGoFramework(installDir: string): 'gin' | 'stdlib' {\n try {\n const goMod = readFileSync(join(installDir, 'go.mod'), 'utf-8');\n return goMod.includes('github.com/gin-gonic/gin') ? 'gin' : 'stdlib';\n } catch {\n return 'stdlib';\n }\n}\n\n/**\n * Write environment variables to .env (Go convention, not .env.local).\n * Merges with existing .env if present.\n */\nfunction writeGoEnv(installDir: string, envVars: Record<string, string>): void {\n const envPath = join(installDir, '.env');\n let existing: Record<string, string> = {};\n\n if (existsSync(envPath)) {\n existing = parseEnvFile(readFileSync(envPath, 'utf-8'));\n }\n\n const merged = { ...existing, ...envVars };\n const content = Object.entries(merged)\n .map(([key, value]) => `${key}=${value}`)\n .join('\\n');\n\n writeFileSync(envPath, content + '\\n');\n}\n\nexport const config: FrameworkConfig = {\n metadata: {\n name: 'Go',\n integration: 'go',\n docsUrl: 'https://workos.com/docs/authkit/vanilla/go',\n skillName: 'workos-go',\n language: 'go',\n stability: 'experimental',\n priority: 50,\n packageManager: 'go',\n manifestFile: 'go.mod',\n gatherContext: async (options) => {\n return { framework: detectGoFramework(options.installDir) };\n },\n },\n\n detection: {\n packageName: 'github.com/workos/workos-go/v4',\n packageDisplayName: 'Go',\n getVersion: () => undefined,\n },\n\n environment: {\n uploadToHosting: false,\n requiresApiKey: true,\n getEnvVars: (apiKey: string, clientId: string) => ({\n WORKOS_API_KEY: apiKey,\n WORKOS_CLIENT_ID: clientId,\n }),\n },\n\n analytics: {\n getTags: (context: any) => (context?.framework ? { 'go-framework': context.framework } : {}),\n },\n\n prompts: {\n getAdditionalContextLines: (context: any) => [\n ...(context?.framework ? [`Go web framework: ${context.framework}`] : []),\n ],\n },\n\n ui: {\n successMessage: 'WorkOS AuthKit integration complete',\n getOutroChanges: () => [\n 'Analyzed your Go project structure',\n 'Installed workos-go SDK',\n 'Created authentication handlers',\n 'Configured environment variables',\n ],\n getOutroNextSteps: () => [\n 'Run `go run .` to start your server',\n 'Visit the WorkOS Dashboard to manage users and settings',\n ],\n },\n};\n\n/**\n * Run the Go integration.\n *\n * Custom flow that bypasses runAgentInstaller because the universal runner\n * assumes package.json exists (getPackageDotJson aborts without it) and\n * port-detection/env-writer are JS-specific.\n */\nexport async function run(options: InstallerOptions): Promise<string> {\n if (options.debug) {\n enableDebugLogs();\n }\n\n options.emitter?.emit('status', {\n message: `Setting up WorkOS AuthKit for ${config.metadata.name}`,\n });\n\n analytics.capture(INSTALLER_INTERACTION_EVENT_NAME, {\n action: 'started agent integration',\n integration: config.metadata.integration,\n });\n\n // Get WorkOS credentials\n const { apiKey, clientId } = await getOrAskForWorkOSCredentials(options, config.environment.requiresApiKey);\n\n // Auto-configure WorkOS environment (redirect URI, CORS)\n const callerHandledConfig = Boolean(options.apiKey || options.clientId);\n if (!callerHandledConfig && apiKey) {\n const redirectUri = options.redirectUri || `http://localhost:${GO_DEFAULT_PORT}${GO_CALLBACK_PATH}`;\n await autoConfigureWorkOSEnvironment(apiKey, config.metadata.integration, GO_DEFAULT_PORT, {\n homepageUrl: options.homepageUrl,\n redirectUri,\n });\n }\n\n // Gather Go-specific context\n const frameworkContext = config.metadata.gatherContext ? await config.metadata.gatherContext(options) : {};\n\n // Write .env (not .env.local — Go convention)\n if (!callerHandledConfig) {\n const redirectUri = options.redirectUri || `http://localhost:${GO_DEFAULT_PORT}${GO_CALLBACK_PATH}`;\n writeGoEnv(options.installDir, {\n ...(apiKey ? { WORKOS_API_KEY: apiKey } : {}),\n WORKOS_CLIENT_ID: clientId,\n WORKOS_REDIRECT_URI: redirectUri,\n });\n }\n\n // Set analytics tags\n const contextTags = config.analytics.getTags(frameworkContext);\n Object.entries(contextTags).forEach(([key, value]) => {\n analytics.setTag(key, value);\n });\n\n // Build prompt\n const additionalLines = config.prompts.getAdditionalContextLines\n ? config.prompts.getAdditionalContextLines(frameworkContext)\n : [];\n const additionalContext =\n additionalLines.length > 0 ? '\\n' + additionalLines.map((line) => `- ${line}`).join('\\n') : '';\n\n const skillName = config.metadata.skillName!;\n const integrationPrompt = `You are integrating WorkOS AuthKit into this ${config.metadata.name} application.\n\n## Project Context\n\n- Language: Go\n- Framework: ${frameworkContext.framework === 'gin' ? 'Gin' : 'stdlib net/http'}${additionalContext}\n\n## Environment\n\nThe following environment variables have been configured in .env:\n- WORKOS_API_KEY\n- WORKOS_CLIENT_ID\n- WORKOS_REDIRECT_URI\n\n## Your Task\n\nUse the \\`${skillName}\\` skill to integrate WorkOS AuthKit into this application.\n\nThe skill contains step-by-step instructions including:\n1. Fetching the SDK documentation\n2. Installing the SDK\n3. Detecting Gin vs stdlib\n4. Creating authentication handlers\n5. Wiring handlers into the router\n6. Verification with go build and go vet\n\nReport your progress using [STATUS] prefixes.\n\nBegin by invoking the ${skillName} skill.`;\n\n // Initialize and run agent\n const agent = await initializeAgent(\n {\n workingDirectory: options.installDir,\n workOSApiKey: apiKey,\n workOSApiHost: 'https://api.workos.com',\n },\n options,\n );\n\n const agentResult = await runAgent(\n agent,\n integrationPrompt,\n options,\n {\n spinnerMessage: SPINNER_MESSAGE,\n successMessage: config.ui.successMessage,\n errorMessage: 'Integration failed',\n },\n options.emitter,\n );\n\n if (agentResult.error) {\n await analytics.shutdown('error');\n const message = agentResult.errorMessage || agentResult.error;\n throw new Error(`Agent SDK error: ${message}`);\n }\n\n // Post-installation validation (gracefully skips — no rules file for Go)\n if (!options.noValidate) {\n options.emitter?.emit('validation:start', { framework: config.metadata.integration });\n\n const validationResult = await validateInstallation(config.metadata.integration, options.installDir, {\n runBuild: true,\n });\n\n if (validationResult.issues.length > 0) {\n options.emitter?.emit('validation:issues', { issues: validationResult.issues });\n }\n\n options.emitter?.emit('validation:complete', {\n passed: validationResult.passed,\n issueCount: validationResult.issues.length,\n durationMs: validationResult.durationMs,\n });\n }\n\n // Build summary\n const changes = config.ui.getOutroChanges(frameworkContext).filter(Boolean);\n const nextSteps = config.ui.getOutroNextSteps(frameworkContext).filter(Boolean);\n\n const lines: string[] = [\n 'Successfully installed WorkOS AuthKit!',\n '',\n ...(changes.length > 0 ? ['What the agent did:', ...changes.map((c) => `• ${c}`), ''] : []),\n ...(nextSteps.length > 0 ? ['Next steps:', ...nextSteps.map((s) => `• ${s}`), ''] : []),\n `Learn more: ${config.metadata.docsUrl}`,\n '',\n 'Note: This installer uses an LLM agent to analyze and modify your project. Please review the changes made.',\n ];\n\n await analytics.shutdown('success');\n\n return lines.join('\\n');\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/integrations/go/index.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,eAAe,EAAE,MAAM,+BA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G,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACvF,eAAe,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE;QACxC,EAAE;QACF,4GAA4G;KAC7G,CAAC;IAEF,MAAM,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAEpC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["/* Go integration — auto-discovered by registry */\nimport { existsSync, readFileSync, writeFileSync } from 'node:fs';\nimport { join } from 'node:path';\nimport type { FrameworkConfig } from '../../lib/framework-config.js';\nimport { SPINNER_MESSAGE } from '../../lib/framework-config.js';\nimport type { InstallerOptions } from '../../utils/types.js';\nimport { enableDebugLogs } from '../../utils/debug.js';\nimport { analytics } from '../../utils/analytics.js';\nimport { INSTALLER_INTERACTION_EVENT_NAME } from '../../lib/constants.js';\nimport { initializeAgent, runAgent } from '../../lib/agent-interface.js';\nimport { getOrAskForWorkOSCredentials } from '../../utils/clack-utils.js';\nimport { autoConfigureWorkOSEnvironment } from '../../lib/workos-management.js';\nimport { validateInstallation } from '../../lib/validation/index.js';\nimport { parseEnvFile } from '../../utils/env-parser.js';\n\n/** Default port for Go HTTP servers */\nconst GO_DEFAULT_PORT = 8080;\nconst GO_CALLBACK_PATH = '/auth/callback';\n\n/**\n * Detect whether go.mod includes the Gin web framework.\n */\nfunction detectGoFramework(installDir: string): 'gin' | 'stdlib' {\n try {\n const goMod = readFileSync(join(installDir, 'go.mod'), 'utf-8');\n return goMod.includes('github.com/gin-gonic/gin') ? 'gin' : 'stdlib';\n } catch {\n return 'stdlib';\n }\n}\n\n/**\n * Write environment variables to .env (Go convention, not .env.local).\n * Merges with existing .env if present.\n */\nfunction writeGoEnv(installDir: string, envVars: Record<string, string>): void {\n const envPath = join(installDir, '.env');\n let existing: Record<string, string> = {};\n\n if (existsSync(envPath)) {\n existing = parseEnvFile(readFileSync(envPath, 'utf-8'));\n }\n\n const merged = { ...existing, ...envVars };\n const content = Object.entries(merged)\n .map(([key, value]) => `${key}=${value}`)\n .join('\\n');\n\n writeFileSync(envPath, content + '\\n');\n}\n\nexport const config: FrameworkConfig = {\n metadata: {\n name: 'Go',\n integration: 'go',\n docsUrl: 'https://workos.com/docs/authkit/vanilla/go',\n skillName: 'workos-go',\n language: 'go',\n stability: 'experimental',\n priority: 50,\n packageManager: 'go',\n manifestFile: 'go.mod',\n gatherContext: async (options) => {\n return { framework: detectGoFramework(options.installDir) };\n },\n },\n\n detection: {\n packageName: 'github.com/workos/workos-go/v4',\n packageDisplayName: 'Go',\n getVersion: () => undefined,\n },\n\n environment: {\n uploadToHosting: false,\n requiresApiKey: true,\n getEnvVars: (apiKey: string, clientId: string) => ({\n WORKOS_API_KEY: apiKey,\n WORKOS_CLIENT_ID: clientId,\n }),\n },\n\n analytics: {\n getTags: (context: any) => (context?.framework ? { 'go-framework': context.framework } : {}),\n },\n\n prompts: {\n getAdditionalContextLines: (context: any) => (context?.framework ? [`Go web framework: ${context.framework}`] : []),\n },\n\n ui: {\n successMessage: 'WorkOS AuthKit integration complete',\n getOutroChanges: () => [\n 'Analyzed your Go project structure',\n 'Installed workos-go SDK',\n 'Created authentication handlers',\n 'Configured environment variables',\n ],\n getOutroNextSteps: () => [\n 'Run `go run .` to start your server',\n 'Visit the WorkOS Dashboard to manage users and settings',\n ],\n },\n};\n\n/**\n * Run the Go integration.\n *\n * Custom flow that bypasses runAgentInstaller because the universal runner\n * assumes package.json exists (getPackageDotJson aborts without it) and\n * port-detection/env-writer are JS-specific.\n */\nexport async function run(options: InstallerOptions): Promise<string> {\n if (options.debug) {\n enableDebugLogs();\n }\n\n options.emitter?.emit('status', {\n message: `Setting up WorkOS AuthKit for ${config.metadata.name}`,\n });\n\n analytics.capture(INSTALLER_INTERACTION_EVENT_NAME, {\n action: 'started agent integration',\n integration: config.metadata.integration,\n });\n\n // Get WorkOS credentials\n const { apiKey, clientId } = await getOrAskForWorkOSCredentials(options, config.environment.requiresApiKey);\n\n // Auto-configure WorkOS environment (redirect URI, CORS)\n const callerHandledConfig = Boolean(options.apiKey || options.clientId);\n if (!callerHandledConfig && apiKey) {\n const redirectUri = options.redirectUri || `http://localhost:${GO_DEFAULT_PORT}${GO_CALLBACK_PATH}`;\n await autoConfigureWorkOSEnvironment(apiKey, config.metadata.integration, GO_DEFAULT_PORT, {\n homepageUrl: options.homepageUrl,\n redirectUri,\n });\n }\n\n // Gather Go-specific context\n const frameworkContext = config.metadata.gatherContext ? await config.metadata.gatherContext(options) : {};\n\n // Write .env (not .env.local — Go convention)\n if (!callerHandledConfig) {\n const redirectUri = options.redirectUri || `http://localhost:${GO_DEFAULT_PORT}${GO_CALLBACK_PATH}`;\n writeGoEnv(options.installDir, {\n ...(apiKey ? { WORKOS_API_KEY: apiKey } : {}),\n WORKOS_CLIENT_ID: clientId,\n WORKOS_REDIRECT_URI: redirectUri,\n });\n }\n\n // Set analytics tags\n const contextTags = config.analytics.getTags(frameworkContext);\n Object.entries(contextTags).forEach(([key, value]) => {\n analytics.setTag(key, value);\n });\n\n // Build prompt\n const additionalLines = config.prompts.getAdditionalContextLines\n ? config.prompts.getAdditionalContextLines(frameworkContext)\n : [];\n const additionalContext =\n additionalLines.length > 0 ? '\\n' + additionalLines.map((line) => `- ${line}`).join('\\n') : '';\n\n const skillName = config.metadata.skillName!;\n const integrationPrompt = `You are integrating WorkOS AuthKit into this ${config.metadata.name} application.\n\n## Project Context\n\n- Language: Go\n- Framework: ${frameworkContext.framework === 'gin' ? 'Gin' : 'stdlib net/http'}${additionalContext}\n\n## Environment\n\nThe following environment variables have been configured in .env:\n- WORKOS_API_KEY\n- WORKOS_CLIENT_ID\n- WORKOS_REDIRECT_URI\n\n## Your Task\n\nUse the \\`${skillName}\\` skill to integrate WorkOS AuthKit into this application.\n\nThe skill contains step-by-step instructions including:\n1. Fetching the SDK documentation\n2. Installing the SDK\n3. Detecting Gin vs stdlib\n4. Creating authentication handlers\n5. Wiring handlers into the router\n6. Verification with go build and go vet\n\nReport your progress using [STATUS] prefixes.\n\nBegin by invoking the ${skillName} skill.`;\n\n // Initialize and run agent\n const agent = await initializeAgent(\n {\n workingDirectory: options.installDir,\n workOSApiKey: apiKey,\n workOSApiHost: 'https://api.workos.com',\n },\n options,\n );\n\n const agentResult = await runAgent(\n agent,\n integrationPrompt,\n options,\n {\n spinnerMessage: SPINNER_MESSAGE,\n successMessage: config.ui.successMessage,\n errorMessage: 'Integration failed',\n },\n options.emitter,\n );\n\n if (agentResult.error) {\n await analytics.shutdown('error');\n const message = agentResult.errorMessage || agentResult.error;\n throw new Error(`Agent SDK error: ${message}`);\n }\n\n // Post-installation validation (gracefully skips — no rules file for Go)\n if (!options.noValidate) {\n options.emitter?.emit('validation:start', { framework: config.metadata.integration });\n\n const validationResult = await validateInstallation(config.metadata.integration, options.installDir, {\n runBuild: true,\n });\n\n if (validationResult.issues.length > 0) {\n options.emitter?.emit('validation:issues', { issues: validationResult.issues });\n }\n\n options.emitter?.emit('validation:complete', {\n passed: validationResult.passed,\n issueCount: validationResult.issues.length,\n durationMs: validationResult.durationMs,\n });\n }\n\n // Build summary\n const changes = config.ui.getOutroChanges(frameworkContext).filter(Boolean);\n const nextSteps = config.ui.getOutroNextSteps(frameworkContext).filter(Boolean);\n\n const lines: string[] = [\n 'Successfully installed WorkOS AuthKit!',\n '',\n ...(changes.length > 0 ? ['What the agent did:', ...changes.map((c) => `• ${c}`), ''] : []),\n ...(nextSteps.length > 0 ? ['Next steps:', ...nextSteps.map((s) => `• ${s}`), ''] : []),\n `Learn more: ${config.metadata.docsUrl}`,\n '',\n 'Note: This installer uses an LLM agent to analyze and modify your project. Please review the changes made.',\n ];\n\n await analytics.shutdown('success');\n\n return lines.join('\\n');\n}\n"]}
@@ -0,0 +1,67 @@
1
+ import type { InstallerAdapter, AdapterConfig } from './types.js';
2
+ import type { InstallerEventEmitter } from '../events.js';
3
+ /**
4
+ * Options controlling headless adapter behavior.
5
+ * Corresponds to CLI flags passed in non-interactive mode.
6
+ */
7
+ export interface HeadlessOptions {
8
+ apiKey?: string;
9
+ clientId?: string;
10
+ noBranch?: boolean;
11
+ noCommit?: boolean;
12
+ createPr?: boolean;
13
+ noGitCheck?: boolean;
14
+ }
15
+ /**
16
+ * Non-interactive adapter for CI/CD and agent consumption.
17
+ *
18
+ * Subscribes to the same installer events as CLIAdapter but never prompts.
19
+ * All decisions are auto-resolved with sensible defaults (overridable via flags).
20
+ * Progress is streamed as NDJSON to stdout.
21
+ */
22
+ export declare class HeadlessAdapter implements InstallerAdapter {
23
+ readonly emitter: InstallerEventEmitter;
24
+ private sendEvent;
25
+ private debug;
26
+ private options;
27
+ private isStarted;
28
+ private handlers;
29
+ constructor(config: AdapterConfig & {
30
+ options: HeadlessOptions;
31
+ });
32
+ start(): Promise<void>;
33
+ stop(): Promise<void>;
34
+ private subscribe;
35
+ private debugLog;
36
+ private handleAuthSuccess;
37
+ private handleAuthFailure;
38
+ private handleDetectionComplete;
39
+ private handleDetectionNone;
40
+ private handleGitDirty;
41
+ private handleCredentialsFound;
42
+ private handleCredentialsRequest;
43
+ private handleEnvScanPrompt;
44
+ private handleEnvCredentialsFound;
45
+ private handleDeviceStarted;
46
+ private handleStagingFetching;
47
+ private handleStagingSuccess;
48
+ private handleConfigComplete;
49
+ private handleAgentStart;
50
+ private handleAgentProgress;
51
+ private handleValidationStart;
52
+ private handleValidationIssues;
53
+ private handleValidationComplete;
54
+ private handleBranchPrompt;
55
+ private handleBranchCreated;
56
+ private handlePostInstallChanges;
57
+ private handleCommitPrompt;
58
+ private handleCommitSuccess;
59
+ private handleCommitFailed;
60
+ private handlePrPrompt;
61
+ private handlePrSuccess;
62
+ private handlePrFailed;
63
+ private handlePushFailed;
64
+ private handleManualInstructions;
65
+ private handleComplete;
66
+ private handleError;
67
+ }
@@ -0,0 +1,263 @@
1
+ import { writeNDJSON } from '../../utils/ndjson.js';
2
+ import { ExitCode } from '../../utils/exit-codes.js';
3
+ /**
4
+ * Non-interactive adapter for CI/CD and agent consumption.
5
+ *
6
+ * Subscribes to the same installer events as CLIAdapter but never prompts.
7
+ * All decisions are auto-resolved with sensible defaults (overridable via flags).
8
+ * Progress is streamed as NDJSON to stdout.
9
+ */
10
+ export class HeadlessAdapter {
11
+ emitter;
12
+ sendEvent;
13
+ debug;
14
+ options;
15
+ isStarted = false;
16
+ handlers = new Map();
17
+ constructor(config) {
18
+ this.emitter = config.emitter;
19
+ this.sendEvent = config.sendEvent;
20
+ this.debug = config.debug ?? false;
21
+ this.options = config.options;
22
+ }
23
+ async start() {
24
+ if (this.isStarted)
25
+ return;
26
+ this.isStarted = true;
27
+ // Auth events
28
+ this.subscribe('auth:success', this.handleAuthSuccess);
29
+ this.subscribe('auth:failure', this.handleAuthFailure);
30
+ // Detection events
31
+ this.subscribe('detection:complete', this.handleDetectionComplete);
32
+ this.subscribe('detection:none', this.handleDetectionNone);
33
+ // Git events — auto-resolve
34
+ this.subscribe('git:dirty', this.handleGitDirty);
35
+ // Credential events — auto-resolve
36
+ this.subscribe('credentials:found', this.handleCredentialsFound);
37
+ this.subscribe('credentials:request', this.handleCredentialsRequest);
38
+ this.subscribe('credentials:env:prompt', this.handleEnvScanPrompt);
39
+ this.subscribe('credentials:env:found', this.handleEnvCredentialsFound);
40
+ // Device auth (should not happen in headless, but log if it does)
41
+ this.subscribe('device:started', this.handleDeviceStarted);
42
+ // Staging
43
+ this.subscribe('staging:fetching', this.handleStagingFetching);
44
+ this.subscribe('staging:success', this.handleStagingSuccess);
45
+ // Config
46
+ this.subscribe('config:complete', this.handleConfigComplete);
47
+ // Agent progress
48
+ this.subscribe('agent:start', this.handleAgentStart);
49
+ this.subscribe('agent:progress', this.handleAgentProgress);
50
+ // Validation
51
+ this.subscribe('validation:start', this.handleValidationStart);
52
+ this.subscribe('validation:issues', this.handleValidationIssues);
53
+ this.subscribe('validation:complete', this.handleValidationComplete);
54
+ // Branch — auto-resolve
55
+ this.subscribe('branch:prompt', this.handleBranchPrompt);
56
+ this.subscribe('branch:created', this.handleBranchCreated);
57
+ // Post-install — auto-resolve
58
+ this.subscribe('postinstall:changes', this.handlePostInstallChanges);
59
+ this.subscribe('postinstall:commit:prompt', this.handleCommitPrompt);
60
+ this.subscribe('postinstall:commit:success', this.handleCommitSuccess);
61
+ this.subscribe('postinstall:commit:failed', this.handleCommitFailed);
62
+ this.subscribe('postinstall:pr:prompt', this.handlePrPrompt);
63
+ this.subscribe('postinstall:pr:success', this.handlePrSuccess);
64
+ this.subscribe('postinstall:pr:failed', this.handlePrFailed);
65
+ this.subscribe('postinstall:push:failed', this.handlePushFailed);
66
+ this.subscribe('postinstall:manual', this.handleManualInstructions);
67
+ // Terminal events
68
+ this.subscribe('complete', this.handleComplete);
69
+ this.subscribe('error', this.handleError);
70
+ }
71
+ async stop() {
72
+ if (!this.isStarted)
73
+ return;
74
+ for (const [event, handler] of this.handlers) {
75
+ this.emitter.off(event, handler);
76
+ }
77
+ this.handlers.clear();
78
+ this.isStarted = false;
79
+ }
80
+ subscribe(event, handler) {
81
+ const boundHandler = handler.bind(this);
82
+ this.handlers.set(event, boundHandler);
83
+ this.emitter.on(event, boundHandler);
84
+ }
85
+ debugLog(message) {
86
+ if (this.debug) {
87
+ writeNDJSON({ type: 'debug', message });
88
+ }
89
+ }
90
+ // ===== Auth Handlers =====
91
+ handleAuthSuccess = () => {
92
+ writeNDJSON({ type: 'auth:success' });
93
+ };
94
+ handleAuthFailure = ({ message }) => {
95
+ writeNDJSON({ type: 'auth:required', message });
96
+ process.exit(ExitCode.AUTH_REQUIRED);
97
+ };
98
+ // ===== Detection Handlers =====
99
+ handleDetectionComplete = ({ integration }) => {
100
+ writeNDJSON({ type: 'detection:complete', integration });
101
+ };
102
+ handleDetectionNone = () => {
103
+ writeNDJSON({ type: 'detection:none' });
104
+ };
105
+ // ===== Git Handlers (auto-resolve) =====
106
+ handleGitDirty = ({ files }) => {
107
+ writeNDJSON({ type: 'git:status', dirty: true, files });
108
+ if (this.options.noGitCheck) {
109
+ writeNDJSON({ type: 'git:decision', action: 'continue' });
110
+ this.sendEvent({ type: 'GIT_CONFIRMED' });
111
+ return;
112
+ }
113
+ writeNDJSON({
114
+ type: 'error',
115
+ code: 'git_dirty',
116
+ message: 'Git working tree is dirty in non-interactive mode. ' +
117
+ 'Commit or stash your changes, or rerun with --no-git-check to proceed.',
118
+ });
119
+ writeNDJSON({ type: 'git:decision', action: 'cancel' });
120
+ this.sendEvent({ type: 'GIT_CANCELLED' });
121
+ process.exit(ExitCode.GENERAL_ERROR);
122
+ };
123
+ // ===== Credential Handlers (auto-resolve) =====
124
+ handleCredentialsFound = () => {
125
+ writeNDJSON({ type: 'credentials:found', source: 'env' });
126
+ };
127
+ handleCredentialsRequest = ({ requiresApiKey }) => {
128
+ if (!this.options.clientId) {
129
+ writeNDJSON({
130
+ type: 'error',
131
+ code: 'missing_credentials',
132
+ message: 'Client ID required in non-interactive mode. Pass --client-id flag.',
133
+ });
134
+ process.exit(ExitCode.GENERAL_ERROR);
135
+ }
136
+ if (requiresApiKey && !this.options.apiKey) {
137
+ writeNDJSON({
138
+ type: 'error',
139
+ code: 'missing_credentials',
140
+ message: 'API key required for this framework. Pass --api-key flag.',
141
+ });
142
+ process.exit(ExitCode.GENERAL_ERROR);
143
+ }
144
+ writeNDJSON({ type: 'credentials:provided', source: 'flag' });
145
+ this.sendEvent({
146
+ type: 'CREDENTIALS_SUBMITTED',
147
+ apiKey: this.options.apiKey ?? '',
148
+ clientId: this.options.clientId,
149
+ });
150
+ };
151
+ handleEnvScanPrompt = () => {
152
+ writeNDJSON({ type: 'credentials:env:scanning' });
153
+ this.sendEvent({ type: 'ENV_SCAN_APPROVED' });
154
+ };
155
+ handleEnvCredentialsFound = ({ sourcePath }) => {
156
+ writeNDJSON({ type: 'credentials:found', source: 'env', sourcePath });
157
+ };
158
+ // ===== Device Auth (should not occur in headless) =====
159
+ handleDeviceStarted = ({ verificationUri, userCode }) => {
160
+ writeNDJSON({
161
+ type: 'auth:device_required',
162
+ verificationUri,
163
+ userCode,
164
+ message: 'Device auth cannot proceed in non-interactive mode',
165
+ });
166
+ };
167
+ // ===== Staging =====
168
+ handleStagingFetching = () => {
169
+ writeNDJSON({ type: 'staging:fetching' });
170
+ };
171
+ handleStagingSuccess = () => {
172
+ writeNDJSON({ type: 'staging:success' });
173
+ };
174
+ // ===== Config =====
175
+ handleConfigComplete = () => {
176
+ writeNDJSON({ type: 'config:complete' });
177
+ };
178
+ // ===== Agent Progress =====
179
+ handleAgentStart = () => {
180
+ writeNDJSON({ type: 'agent:start' });
181
+ };
182
+ handleAgentProgress = ({ step, detail }) => {
183
+ const message = detail ? `${step}: ${detail}` : step;
184
+ writeNDJSON({ type: 'agent:progress', message });
185
+ };
186
+ // ===== Validation =====
187
+ handleValidationStart = ({ framework }) => {
188
+ writeNDJSON({ type: 'validation:start', framework });
189
+ };
190
+ handleValidationIssues = ({ issues }) => {
191
+ for (const issue of issues) {
192
+ writeNDJSON({ type: 'validation:issue', severity: issue.severity, message: issue.message });
193
+ }
194
+ };
195
+ handleValidationComplete = ({ passed, issueCount }) => {
196
+ writeNDJSON({ type: 'validation:complete', passed, issues: issueCount });
197
+ };
198
+ // ===== Branch (auto-resolve) =====
199
+ handleBranchPrompt = () => {
200
+ if (this.options.noBranch) {
201
+ writeNDJSON({ type: 'branch:skipped', reason: '--no-branch flag' });
202
+ this.sendEvent({ type: 'BRANCH_CONTINUE' });
203
+ }
204
+ else {
205
+ writeNDJSON({ type: 'branch:creating' });
206
+ this.sendEvent({ type: 'BRANCH_CREATE' });
207
+ }
208
+ };
209
+ handleBranchCreated = ({ branch }) => {
210
+ writeNDJSON({ type: 'branch:created', name: branch });
211
+ };
212
+ // ===== Post-install (auto-resolve) =====
213
+ handlePostInstallChanges = ({ files }) => {
214
+ writeNDJSON({ type: 'postinstall:changes', files, count: files.length });
215
+ };
216
+ handleCommitPrompt = () => {
217
+ if (this.options.noCommit) {
218
+ writeNDJSON({ type: 'commit:skipped', reason: '--no-commit flag' });
219
+ this.sendEvent({ type: 'COMMIT_DECLINED' });
220
+ }
221
+ else {
222
+ writeNDJSON({ type: 'commit:auto' });
223
+ this.sendEvent({ type: 'COMMIT_APPROVED' });
224
+ }
225
+ };
226
+ handleCommitSuccess = ({ message }) => {
227
+ writeNDJSON({ type: 'commit:created', message });
228
+ };
229
+ handleCommitFailed = ({ error }) => {
230
+ writeNDJSON({ type: 'commit:failed', error });
231
+ };
232
+ handlePrPrompt = () => {
233
+ if (this.options.createPr) {
234
+ writeNDJSON({ type: 'pr:creating' });
235
+ this.sendEvent({ type: 'PR_APPROVED' });
236
+ }
237
+ else {
238
+ writeNDJSON({ type: 'pr:skipped', reason: '--create-pr not set' });
239
+ this.sendEvent({ type: 'PR_DECLINED' });
240
+ }
241
+ };
242
+ handlePrSuccess = ({ url }) => {
243
+ writeNDJSON({ type: 'pr:created', url });
244
+ };
245
+ handlePrFailed = ({ error }) => {
246
+ writeNDJSON({ type: 'pr:failed', error });
247
+ };
248
+ handlePushFailed = ({ error }) => {
249
+ writeNDJSON({ type: 'push:failed', error });
250
+ };
251
+ handleManualInstructions = ({ instructions }) => {
252
+ writeNDJSON({ type: 'postinstall:manual', instructions });
253
+ };
254
+ // ===== Terminal Events =====
255
+ handleComplete = ({ success, summary }) => {
256
+ writeNDJSON({ type: 'complete', success, summary });
257
+ };
258
+ handleError = ({ message, stack }) => {
259
+ writeNDJSON({ type: 'error', code: 'installer_error', message });
260
+ this.debugLog(stack ?? '');
261
+ };
262
+ }
263
+ //# sourceMappingURL=headless-adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"headless-adapter.js","sourceRoot":"","sources":["../../../src/lib/adapters/headless-adapter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAerD;;;;;;GA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4B,EAAQ,EAAE;QAC3E,WAAW,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,CAAC,CAAC;QACjE,IAAI,CAAC,QAAQ,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IAC7B,CAAC,CAAC;CACH","sourcesContent":["import type { InstallerAdapter, AdapterConfig } from './types.js';\nimport type { InstallerEventEmitter, InstallerEvents } from '../events.js';\nimport { writeNDJSON } from '../../utils/ndjson.js';\nimport { ExitCode } from '../../utils/exit-codes.js';\n\n/**\n * Options controlling headless adapter behavior.\n * Corresponds to CLI flags passed in non-interactive mode.\n */\nexport interface HeadlessOptions {\n apiKey?: string;\n clientId?: string;\n noBranch?: boolean;\n noCommit?: boolean;\n createPr?: boolean;\n noGitCheck?: boolean;\n}\n\n/**\n * Non-interactive adapter for CI/CD and agent consumption.\n *\n * Subscribes to the same installer events as CLIAdapter but never prompts.\n * All decisions are auto-resolved with sensible defaults (overridable via flags).\n * Progress is streamed as NDJSON to stdout.\n */\nexport class HeadlessAdapter implements InstallerAdapter {\n readonly emitter: InstallerEventEmitter;\n private sendEvent: AdapterConfig['sendEvent'];\n private debug: boolean;\n private options: HeadlessOptions;\n private isStarted = false;\n private handlers = new Map<string, (...args: unknown[]) => void>();\n\n constructor(config: AdapterConfig & { options: HeadlessOptions }) {\n this.emitter = config.emitter;\n this.sendEvent = config.sendEvent;\n this.debug = config.debug ?? false;\n this.options = config.options;\n }\n\n async start(): Promise<void> {\n if (this.isStarted) return;\n this.isStarted = true;\n\n // Auth events\n this.subscribe('auth:success', this.handleAuthSuccess);\n this.subscribe('auth:failure', this.handleAuthFailure);\n\n // Detection events\n this.subscribe('detection:complete', this.handleDetectionComplete);\n this.subscribe('detection:none', this.handleDetectionNone);\n\n // Git events — auto-resolve\n this.subscribe('git:dirty', this.handleGitDirty);\n\n // Credential events — auto-resolve\n this.subscribe('credentials:found', this.handleCredentialsFound);\n this.subscribe('credentials:request', this.handleCredentialsRequest);\n this.subscribe('credentials:env:prompt', this.handleEnvScanPrompt);\n this.subscribe('credentials:env:found', this.handleEnvCredentialsFound);\n\n // Device auth (should not happen in headless, but log if it does)\n this.subscribe('device:started', this.handleDeviceStarted);\n\n // Staging\n this.subscribe('staging:fetching', this.handleStagingFetching);\n this.subscribe('staging:success', this.handleStagingSuccess);\n\n // Config\n this.subscribe('config:complete', this.handleConfigComplete);\n\n // Agent progress\n this.subscribe('agent:start', this.handleAgentStart);\n this.subscribe('agent:progress', this.handleAgentProgress);\n\n // Validation\n this.subscribe('validation:start', this.handleValidationStart);\n this.subscribe('validation:issues', this.handleValidationIssues);\n this.subscribe('validation:complete', this.handleValidationComplete);\n\n // Branch — auto-resolve\n this.subscribe('branch:prompt', this.handleBranchPrompt);\n this.subscribe('branch:created', this.handleBranchCreated);\n\n // Post-install — auto-resolve\n this.subscribe('postinstall:changes', this.handlePostInstallChanges);\n this.subscribe('postinstall:commit:prompt', this.handleCommitPrompt);\n this.subscribe('postinstall:commit:success', this.handleCommitSuccess);\n this.subscribe('postinstall:commit:failed', this.handleCommitFailed);\n this.subscribe('postinstall:pr:prompt', this.handlePrPrompt);\n this.subscribe('postinstall:pr:success', this.handlePrSuccess);\n this.subscribe('postinstall:pr:failed', this.handlePrFailed);\n this.subscribe('postinstall:push:failed', this.handlePushFailed);\n this.subscribe('postinstall:manual', this.handleManualInstructions);\n\n // Terminal events\n this.subscribe('complete', this.handleComplete);\n this.subscribe('error', this.handleError);\n }\n\n async stop(): Promise<void> {\n if (!this.isStarted) return;\n\n for (const [event, handler] of this.handlers) {\n this.emitter.off(event as keyof InstallerEvents, handler as never);\n }\n this.handlers.clear();\n this.isStarted = false;\n }\n\n private subscribe<K extends keyof InstallerEvents>(\n event: K,\n handler: (payload: InstallerEvents[K]) => void | Promise<void>,\n ): void {\n const boundHandler = handler.bind(this);\n this.handlers.set(event, boundHandler as (...args: unknown[]) => void);\n this.emitter.on(event, boundHandler);\n }\n\n private debugLog(message: string): void {\n if (this.debug) {\n writeNDJSON({ type: 'debug', message });\n }\n }\n\n // ===== Auth Handlers =====\n\n private handleAuthSuccess = (): void => {\n writeNDJSON({ type: 'auth:success' });\n };\n\n private handleAuthFailure = ({ message }: InstallerEvents['auth:failure']): void => {\n writeNDJSON({ type: 'auth:required', message });\n process.exit(ExitCode.AUTH_REQUIRED);\n };\n\n // ===== Detection Handlers =====\n\n private handleDetectionComplete = ({ integration }: InstallerEvents['detection:complete']): void => {\n writeNDJSON({ type: 'detection:complete', integration });\n };\n\n private handleDetectionNone = (): void => {\n writeNDJSON({ type: 'detection:none' });\n };\n\n // ===== Git Handlers (auto-resolve) =====\n\n private handleGitDirty = ({ files }: InstallerEvents['git:dirty']): void => {\n writeNDJSON({ type: 'git:status', dirty: true, files });\n\n if (this.options.noGitCheck) {\n writeNDJSON({ type: 'git:decision', action: 'continue' });\n this.sendEvent({ type: 'GIT_CONFIRMED' });\n return;\n }\n\n writeNDJSON({\n type: 'error',\n code: 'git_dirty',\n message:\n 'Git working tree is dirty in non-interactive mode. ' +\n 'Commit or stash your changes, or rerun with --no-git-check to proceed.',\n });\n writeNDJSON({ type: 'git:decision', action: 'cancel' });\n this.sendEvent({ type: 'GIT_CANCELLED' });\n process.exit(ExitCode.GENERAL_ERROR);\n };\n\n // ===== Credential Handlers (auto-resolve) =====\n\n private handleCredentialsFound = (): void => {\n writeNDJSON({ type: 'credentials:found', source: 'env' });\n };\n\n private handleCredentialsRequest = ({ requiresApiKey }: InstallerEvents['credentials:request']): void => {\n if (!this.options.clientId) {\n writeNDJSON({\n type: 'error',\n code: 'missing_credentials',\n message: 'Client ID required in non-interactive mode. Pass --client-id flag.',\n });\n process.exit(ExitCode.GENERAL_ERROR);\n }\n\n if (requiresApiKey && !this.options.apiKey) {\n writeNDJSON({\n type: 'error',\n code: 'missing_credentials',\n message: 'API key required for this framework. Pass --api-key flag.',\n });\n process.exit(ExitCode.GENERAL_ERROR);\n }\n\n writeNDJSON({ type: 'credentials:provided', source: 'flag' });\n this.sendEvent({\n type: 'CREDENTIALS_SUBMITTED',\n apiKey: this.options.apiKey ?? '',\n clientId: this.options.clientId,\n });\n };\n\n private handleEnvScanPrompt = (): void => {\n writeNDJSON({ type: 'credentials:env:scanning' });\n this.sendEvent({ type: 'ENV_SCAN_APPROVED' });\n };\n\n private handleEnvCredentialsFound = ({ sourcePath }: InstallerEvents['credentials:env:found']): void => {\n writeNDJSON({ type: 'credentials:found', source: 'env', sourcePath });\n };\n\n // ===== Device Auth (should not occur in headless) =====\n\n private handleDeviceStarted = ({ verificationUri, userCode }: InstallerEvents['device:started']): void => {\n writeNDJSON({\n type: 'auth:device_required',\n verificationUri,\n userCode,\n message: 'Device auth cannot proceed in non-interactive mode',\n });\n };\n\n // ===== Staging =====\n\n private handleStagingFetching = (): void => {\n writeNDJSON({ type: 'staging:fetching' });\n };\n\n private handleStagingSuccess = (): void => {\n writeNDJSON({ type: 'staging:success' });\n };\n\n // ===== Config =====\n\n private handleConfigComplete = (): void => {\n writeNDJSON({ type: 'config:complete' });\n };\n\n // ===== Agent Progress =====\n\n private handleAgentStart = (): void => {\n writeNDJSON({ type: 'agent:start' });\n };\n\n private handleAgentProgress = ({ step, detail }: InstallerEvents['agent:progress']): void => {\n const message = detail ? `${step}: ${detail}` : step;\n writeNDJSON({ type: 'agent:progress', message });\n };\n\n // ===== Validation =====\n\n private handleValidationStart = ({ framework }: InstallerEvents['validation:start']): void => {\n writeNDJSON({ type: 'validation:start', framework });\n };\n\n private handleValidationIssues = ({ issues }: InstallerEvents['validation:issues']): void => {\n for (const issue of issues) {\n writeNDJSON({ type: 'validation:issue', severity: issue.severity, message: issue.message });\n }\n };\n\n private handleValidationComplete = ({ passed, issueCount }: InstallerEvents['validation:complete']): void => {\n writeNDJSON({ type: 'validation:complete', passed, issues: issueCount });\n };\n\n // ===== Branch (auto-resolve) =====\n\n private handleBranchPrompt = (): void => {\n if (this.options.noBranch) {\n writeNDJSON({ type: 'branch:skipped', reason: '--no-branch flag' });\n this.sendEvent({ type: 'BRANCH_CONTINUE' });\n } else {\n writeNDJSON({ type: 'branch:creating' });\n this.sendEvent({ type: 'BRANCH_CREATE' });\n }\n };\n\n private handleBranchCreated = ({ branch }: InstallerEvents['branch:created']): void => {\n writeNDJSON({ type: 'branch:created', name: branch });\n };\n\n // ===== Post-install (auto-resolve) =====\n\n private handlePostInstallChanges = ({ files }: InstallerEvents['postinstall:changes']): void => {\n writeNDJSON({ type: 'postinstall:changes', files, count: files.length });\n };\n\n private handleCommitPrompt = (): void => {\n if (this.options.noCommit) {\n writeNDJSON({ type: 'commit:skipped', reason: '--no-commit flag' });\n this.sendEvent({ type: 'COMMIT_DECLINED' });\n } else {\n writeNDJSON({ type: 'commit:auto' });\n this.sendEvent({ type: 'COMMIT_APPROVED' });\n }\n };\n\n private handleCommitSuccess = ({ message }: InstallerEvents['postinstall:commit:success']): void => {\n writeNDJSON({ type: 'commit:created', message });\n };\n\n private handleCommitFailed = ({ error }: InstallerEvents['postinstall:commit:failed']): void => {\n writeNDJSON({ type: 'commit:failed', error });\n };\n\n private handlePrPrompt = (): void => {\n if (this.options.createPr) {\n writeNDJSON({ type: 'pr:creating' });\n this.sendEvent({ type: 'PR_APPROVED' });\n } else {\n writeNDJSON({ type: 'pr:skipped', reason: '--create-pr not set' });\n this.sendEvent({ type: 'PR_DECLINED' });\n }\n };\n\n private handlePrSuccess = ({ url }: InstallerEvents['postinstall:pr:success']): void => {\n writeNDJSON({ type: 'pr:created', url });\n };\n\n private handlePrFailed = ({ error }: InstallerEvents['postinstall:pr:failed']): void => {\n writeNDJSON({ type: 'pr:failed', error });\n };\n\n private handlePushFailed = ({ error }: InstallerEvents['postinstall:push:failed']): void => {\n writeNDJSON({ type: 'push:failed', error });\n };\n\n private handleManualInstructions = ({ instructions }: InstallerEvents['postinstall:manual']): void => {\n writeNDJSON({ type: 'postinstall:manual', instructions });\n };\n\n // ===== Terminal Events =====\n\n private handleComplete = ({ success, summary }: InstallerEvents['complete']): void => {\n writeNDJSON({ type: 'complete', success, summary });\n };\n\n private handleError = ({ message, stack }: InstallerEvents['error']): void => {\n writeNDJSON({ type: 'error', code: 'installer_error', message });\n this.debugLog(stack ?? '');\n };\n}\n"]}
@@ -1,3 +1,4 @@
1
1
  export { CLIAdapter } from './cli-adapter.js';
2
2
  export { DashboardAdapter } from './dashboard-adapter.js';
3
+ export { HeadlessAdapter } from './headless-adapter.js';
3
4
  export type { InstallerAdapter, AdapterConfig } from './types.js';
@@ -1,3 +1,4 @@
1
1
  export { CLIAdapter } from './cli-adapter.js';
2
2
  export { DashboardAdapter } from './dashboard-adapter.js';
3
+ export { HeadlessAdapter } from './headless-adapter.js';
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/adapters/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC","sourcesContent":["export { CLIAdapter } from './cli-adapter.js';\nexport { DashboardAdapter } from './dashboard-adapter.js';\nexport type { InstallerAdapter, AdapterConfig } from './types.js';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/adapters/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["export { CLIAdapter } from './cli-adapter.js';\nexport { DashboardAdapter } from './dashboard-adapter.js';\nexport { HeadlessAdapter } from './headless-adapter.js';\nexport type { InstallerAdapter, AdapterConfig } from './types.js';\n"]}
@@ -5,8 +5,7 @@
5
5
  import type { InstallerOptions } from '../utils/types.js';
6
6
  import type { InstallerEventEmitter } from './events.js';
7
7
  import { type CredentialProxyHandle } from './credential-proxy.js';
8
- type SDKMessage = any;
9
- type McpServersConfig = any;
8
+ import type { SDKMessage, Options as AgentSDKOptions, PermissionResult } from '@anthropic-ai/claude-agent-sdk';
10
9
  export declare const AgentSignals: {
11
10
  /** Signal emitted when the agent reports progress to the user */
12
11
  readonly STATUS: "[STATUS]";
@@ -45,7 +44,7 @@ export interface RetryConfig {
45
44
  */
46
45
  export type AgentRunConfig = {
47
46
  workingDirectory: string;
48
- mcpServers: McpServersConfig;
47
+ mcpServers: AgentSDKOptions['mcpServers'];
49
48
  model: string;
50
49
  allowedTools: string[];
51
50
  sdkEnv: Record<string, string | undefined>;
@@ -57,13 +56,7 @@ export type AgentRunConfig = {
57
56
  * - Piping to tail/head for output limiting is allowed
58
57
  * - Stderr redirection (2>&1) is allowed
59
58
  */
60
- export declare function installerCanUseTool(toolName: string, input: Record<string, unknown>): {
61
- behavior: 'allow';
62
- updatedInput: Record<string, unknown>;
63
- } | {
64
- behavior: 'deny';
65
- message: string;
66
- };
59
+ export declare function installerCanUseTool(toolName: string, input: Record<string, unknown>): PermissionResult;
67
60
  /**
68
61
  * Initialize agent configuration for the LLM gateway
69
62
  */
@@ -87,4 +80,3 @@ export declare function runAgent(agentConfig: AgentRunConfig, prompt: string, op
87
80
  * Get the active proxy handle (for testing/debugging).
88
81
  */
89
82
  export declare function getActiveProxyHandle(): CredentialProxyHandle | null;
90
- export {};
@@ -2,8 +2,7 @@
2
2
  * Shared agent interface for WorkOS wizards
3
3
  * Uses Claude Agent SDK directly with WorkOS MCP server
4
4
  */
5
- import path from 'path';
6
- import { fileURLToPath } from 'url';
5
+ import { getPackageRoot } from '../utils/paths.js';
7
6
  import { debug, logInfo, logWarn, logError, initLogFile, getLogFilePath } from '../utils/debug.js';
8
7
  import { analytics } from '../utils/analytics.js';
9
8
  import { INSTALLER_INTERACTION_EVENT_NAME } from './constants.js';
@@ -410,7 +409,7 @@ export async function initializeAgent(config, options) {
410
409
  * @returns An object containing any error detected in the agent's output
411
410
  */
412
411
  export async function runAgent(agentConfig, prompt, options, config, emitter, retryConfig, onMessage) {
413
- const { spinnerMessage = 'Setting up WorkOS AuthKit...', successMessage = 'WorkOS AuthKit integration complete', errorMessage = 'Integration failed', } = config ?? {};
412
+ const { spinnerMessage = 'Setting up WorkOS AuthKit...' } = config ?? {};
414
413
  const { query } = await getSDKModule();
415
414
  // Emit progress for adapters to handle (e.g., CLI adapter starts spinner)
416
415
  emitter?.emit('agent:progress', { step: 'Starting', detail: 'This may take a few minutes. Grab some coffee!' });
@@ -472,10 +471,7 @@ export async function runAgent(agentConfig, prompt, options, config, emitter, re
472
471
  await currentTurnDone;
473
472
  };
474
473
  // Load plugin with bundled skills
475
- // Path from dist/lib/ back to package root
476
- const __filename = fileURLToPath(import.meta.url);
477
- const __dirname = path.dirname(__filename);
478
- const pluginPath = path.join(__dirname, '../..');
474
+ const pluginPath = getPackageRoot(import.meta.url);
479
475
  logInfo('Loading plugin from:', pluginPath);
480
476
  const response = query({
481
477
  prompt: createPromptStream(),
@@ -690,18 +686,6 @@ function handleSDKMessage(message, options, collectedText, emitter) {
690
686
  }
691
687
  break;
692
688
  }
693
- case 'tool': {
694
- // This case may not be used by the current SDK, keeping for compatibility
695
- const toolName = message.tool;
696
- const input = message.input;
697
- if (toolName === 'Read' && message.content) {
698
- const filePath = input?.file_path;
699
- if (filePath && typeof message.content === 'string') {
700
- fileContentCache.set(filePath, message.content);
701
- }
702
- }
703
- break;
704
- }
705
689
  case 'result': {
706
690
  if (message.subtype === 'success') {
707
691
  logInfo('Agent completed successfully');