workos 0.4.5 → 0.5.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 (147) hide show
  1. package/dist/bin.js +32 -3
  2. package/dist/bin.js.map +1 -1
  3. package/dist/commands/doctor.d.ts +10 -0
  4. package/dist/commands/doctor.js +30 -0
  5. package/dist/commands/doctor.js.map +1 -0
  6. package/dist/doctor/checks/connectivity.d.ts +2 -0
  7. package/dist/doctor/checks/connectivity.js +35 -0
  8. package/dist/doctor/checks/connectivity.js.map +1 -0
  9. package/dist/doctor/checks/dashboard.d.ts +3 -0
  10. package/dist/doctor/checks/dashboard.js +123 -0
  11. package/dist/doctor/checks/dashboard.js.map +1 -0
  12. package/dist/doctor/checks/environment.d.ts +2 -0
  13. package/dist/doctor/checks/environment.js +68 -0
  14. package/dist/doctor/checks/environment.js.map +1 -0
  15. package/dist/doctor/checks/framework.d.ts +2 -0
  16. package/dist/doctor/checks/framework.js +75 -0
  17. package/dist/doctor/checks/framework.js.map +1 -0
  18. package/dist/doctor/checks/runtime.d.ts +2 -0
  19. package/dist/doctor/checks/runtime.js +20 -0
  20. package/dist/doctor/checks/runtime.js.map +1 -0
  21. package/dist/doctor/checks/sdk.d.ts +2 -0
  22. package/dist/doctor/checks/sdk.js +111 -0
  23. package/dist/doctor/checks/sdk.js.map +1 -0
  24. package/dist/doctor/clipboard.d.ts +1 -0
  25. package/dist/doctor/clipboard.js +43 -0
  26. package/dist/doctor/clipboard.js.map +1 -0
  27. package/dist/doctor/index.d.ts +6 -0
  28. package/dist/doctor/index.js +94 -0
  29. package/dist/doctor/index.js.map +1 -0
  30. package/dist/doctor/issues.d.ts +58 -0
  31. package/dist/doctor/issues.js +134 -0
  32. package/dist/doctor/issues.js.map +1 -0
  33. package/dist/doctor/json-output.d.ts +2 -0
  34. package/dist/doctor/json-output.js +4 -0
  35. package/dist/doctor/json-output.js.map +1 -0
  36. package/dist/doctor/output.d.ts +5 -0
  37. package/dist/doctor/output.js +149 -0
  38. package/dist/doctor/output.js.map +1 -0
  39. package/dist/doctor/types.d.ts +105 -0
  40. package/dist/doctor/types.js +2 -0
  41. package/dist/doctor/types.js.map +1 -0
  42. package/dist/integrations/dotnet/index.d.ts +8 -0
  43. package/dist/integrations/dotnet/index.js +163 -0
  44. package/dist/integrations/dotnet/index.js.map +1 -0
  45. package/dist/integrations/elixir/index.d.ts +8 -0
  46. package/dist/integrations/elixir/index.js +152 -0
  47. package/dist/integrations/elixir/index.js.map +1 -0
  48. package/dist/integrations/go/index.d.ts +11 -0
  49. package/dist/integrations/go/index.js +220 -0
  50. package/dist/integrations/go/index.js.map +1 -0
  51. package/dist/integrations/kotlin/index.d.ts +4 -0
  52. package/dist/integrations/kotlin/index.js +53 -0
  53. package/dist/integrations/kotlin/index.js.map +1 -0
  54. package/dist/integrations/nextjs/index.d.ts +4 -0
  55. package/dist/integrations/nextjs/index.js +90 -0
  56. package/dist/integrations/nextjs/index.js.map +1 -0
  57. package/dist/integrations/nextjs/utils.d.ts +8 -0
  58. package/dist/integrations/nextjs/utils.js +53 -0
  59. package/dist/integrations/nextjs/utils.js.map +1 -0
  60. package/dist/integrations/node/index.d.ts +4 -0
  61. package/dist/integrations/node/index.js +52 -0
  62. package/dist/integrations/node/index.js.map +1 -0
  63. package/dist/integrations/php/index.d.ts +4 -0
  64. package/dist/integrations/php/index.js +51 -0
  65. package/dist/integrations/php/index.js.map +1 -0
  66. package/dist/integrations/php-laravel/index.d.ts +4 -0
  67. package/dist/integrations/php-laravel/index.js +51 -0
  68. package/dist/integrations/php-laravel/index.js.map +1 -0
  69. package/dist/integrations/python/index.d.ts +9 -0
  70. package/dist/integrations/python/index.js +254 -0
  71. package/dist/integrations/python/index.js.map +1 -0
  72. package/dist/integrations/react/index.d.ts +4 -0
  73. package/dist/integrations/react/index.js +49 -0
  74. package/dist/integrations/react/index.js.map +1 -0
  75. package/dist/integrations/react-router/index.d.ts +4 -0
  76. package/dist/integrations/react-router/index.js +94 -0
  77. package/dist/integrations/react-router/index.js.map +1 -0
  78. package/dist/integrations/react-router/utils.d.ts +10 -0
  79. package/dist/integrations/react-router/utils.js +146 -0
  80. package/dist/integrations/react-router/utils.js.map +1 -0
  81. package/dist/integrations/ruby/index.d.ts +8 -0
  82. package/dist/integrations/ruby/index.js +142 -0
  83. package/dist/integrations/ruby/index.js.map +1 -0
  84. package/dist/integrations/sveltekit/index.d.ts +4 -0
  85. package/dist/integrations/sveltekit/index.js +50 -0
  86. package/dist/integrations/sveltekit/index.js.map +1 -0
  87. package/dist/integrations/tanstack-start/index.d.ts +4 -0
  88. package/dist/integrations/tanstack-start/index.js +51 -0
  89. package/dist/integrations/tanstack-start/index.js.map +1 -0
  90. package/dist/integrations/vanilla-js/index.d.ts +4 -0
  91. package/dist/integrations/vanilla-js/index.js +49 -0
  92. package/dist/integrations/vanilla-js/index.js.map +1 -0
  93. package/dist/lib/agent-interface.js +66 -1
  94. package/dist/lib/agent-interface.js.map +1 -1
  95. package/dist/lib/config.d.ts +32 -58
  96. package/dist/lib/config.js +19 -70
  97. package/dist/lib/config.js.map +1 -1
  98. package/dist/lib/constants.d.ts +17 -14
  99. package/dist/lib/constants.js +12 -31
  100. package/dist/lib/constants.js.map +1 -1
  101. package/dist/lib/framework-config.d.ts +13 -4
  102. package/dist/lib/framework-config.js.map +1 -1
  103. package/dist/lib/language-detection.d.ts +20 -0
  104. package/dist/lib/language-detection.js +96 -0
  105. package/dist/lib/language-detection.js.map +1 -0
  106. package/dist/lib/port-detection.js +4 -2
  107. package/dist/lib/port-detection.js.map +1 -1
  108. package/dist/lib/registry.d.ts +43 -0
  109. package/dist/lib/registry.js +96 -0
  110. package/dist/lib/registry.js.map +1 -0
  111. package/dist/lib/run-with-core.js +70 -26
  112. package/dist/lib/run-with-core.js.map +1 -1
  113. package/dist/lib/validation/validator.js +43 -13
  114. package/dist/lib/validation/validator.js.map +1 -1
  115. package/dist/nextjs/nextjs-installer-agent.d.ts +3 -4
  116. package/dist/nextjs/nextjs-installer-agent.js +3 -94
  117. package/dist/nextjs/nextjs-installer-agent.js.map +1 -1
  118. package/dist/nextjs/utils.d.ts +4 -8
  119. package/dist/nextjs/utils.js +4 -52
  120. package/dist/nextjs/utils.js.map +1 -1
  121. package/dist/react/react-installer-agent.d.ts +4 -2
  122. package/dist/react/react-installer-agent.js +4 -46
  123. package/dist/react/react-installer-agent.js.map +1 -1
  124. package/dist/react-router/react-router-installer-agent.d.ts +2 -4
  125. package/dist/react-router/react-router-installer-agent.js +2 -100
  126. package/dist/react-router/react-router-installer-agent.js.map +1 -1
  127. package/dist/react-router/utils.d.ts +2 -17
  128. package/dist/react-router/utils.js +2 -207
  129. package/dist/react-router/utils.js.map +1 -1
  130. package/dist/tanstack-start/tanstack-start-installer-agent.d.ts +4 -2
  131. package/dist/tanstack-start/tanstack-start-installer-agent.js +4 -48
  132. package/dist/tanstack-start/tanstack-start-installer-agent.js.map +1 -1
  133. package/dist/vanilla-js/vanilla-js-installer-agent.d.ts +4 -2
  134. package/dist/vanilla-js/vanilla-js-installer-agent.js +4 -46
  135. package/dist/vanilla-js/vanilla-js-installer-agent.js.map +1 -1
  136. package/package.json +6 -5
  137. package/skills/workos-authkit-nextjs/SKILL.md +41 -11
  138. package/skills/workos-authkit-sveltekit/SKILL.md +160 -0
  139. package/skills/workos-dotnet/SKILL.md +163 -0
  140. package/skills/workos-elixir/SKILL.md +194 -0
  141. package/skills/workos-go/SKILL.md +191 -0
  142. package/skills/workos-kotlin/SKILL.md +161 -0
  143. package/skills/workos-node/SKILL.md +164 -0
  144. package/skills/workos-php/SKILL.md +127 -0
  145. package/skills/workos-php-laravel/SKILL.md +147 -0
  146. package/skills/workos-python/SKILL.md +159 -0
  147. package/skills/workos-ruby/SKILL.md +163 -0
@@ -0,0 +1,51 @@
1
+ import { enableDebugLogs } from '../../utils/debug.js';
2
+ export const config = {
3
+ metadata: {
4
+ name: 'PHP',
5
+ integration: 'php',
6
+ docsUrl: 'https://github.com/workos/workos-php',
7
+ skillName: 'workos-php',
8
+ language: 'php',
9
+ stability: 'experimental',
10
+ priority: 44,
11
+ packageManager: 'composer',
12
+ manifestFile: 'composer.json',
13
+ },
14
+ detection: {
15
+ packageName: 'php',
16
+ packageDisplayName: 'PHP',
17
+ getVersion: () => undefined,
18
+ },
19
+ environment: {
20
+ uploadToHosting: false,
21
+ requiresApiKey: true,
22
+ getEnvVars: (apiKey, clientId) => ({
23
+ WORKOS_API_KEY: apiKey,
24
+ WORKOS_CLIENT_ID: clientId,
25
+ }),
26
+ },
27
+ analytics: {
28
+ getTags: () => ({}),
29
+ },
30
+ prompts: {},
31
+ ui: {
32
+ successMessage: 'WorkOS AuthKit integration complete',
33
+ getOutroChanges: () => [
34
+ 'Analyzed your PHP project structure',
35
+ 'Installed and configured WorkOS PHP SDK',
36
+ 'Created authentication endpoint files',
37
+ ],
38
+ getOutroNextSteps: () => [
39
+ 'Start your PHP development server to test authentication',
40
+ 'Visit the WorkOS Dashboard to manage users and settings',
41
+ ],
42
+ },
43
+ };
44
+ export async function run(options) {
45
+ if (options.debug) {
46
+ enableDebugLogs();
47
+ }
48
+ const { runAgentInstaller } = await import('../../lib/agent-runner.js');
49
+ return runAgentInstaller(config, options);
50
+ }
51
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/integrations/php/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,CAAC,MAAM,MAAM,GAAoB;IACrC,QAAQ,EAAE;QACR,IAAI,EAAE,KAAK;QACX,WAAW,EAAE,KAAK;QAClB,OAAO,EAAE,sCAAsC;QAC/C,SAAS,EAAE,YAAY;QACvB,QAAQ,EAAE,KAAK;QACf,SAAS,EAAE,cAAc;QACzB,QAAQ,EAAE,EAAE;QACZ,cAAc,EAAE,UAAU;QAC1B,YAAY,EAAE,eAAe;KAC9B;IAED,SAAS,EAAE;QACT,WAAW,EAAE,KAAK;QAClB,kBAAkB,EAAE,KAAK;QACzB,UAAU,EAAE,GAAG,EAAE,CAAC,SAAS;KAC5B;IAED,WAAW,EAAE;QACX,eAAe,EAAE,KAAK;QACtB,cAAc,EAAE,IAAI;QACpB,UAAU,EAAE,CAAC,MAAc,EAAE,QAAgB,EAAE,EAAE,CAAC,CAAC;YACjD,cAAc,EAAE,MAAM;YACtB,gBAAgB,EAAE,QAAQ;SAC3B,CAAC;KACH;IAED,SAAS,EAAE;QACT,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;KACpB;IAED,OAAO,EAAE,EAAE;IAEX,EAAE,EAAE;QACF,cAAc,EAAE,qCAAqC;QACrD,eAAe,EAAE,GAAG,EAAE,CAAC;YACrB,qCAAqC;YACrC,yCAAyC;YACzC,uCAAuC;SACxC;QACD,iBAAiB,EAAE,GAAG,EAAE,CAAC;YACvB,0DAA0D;YAC1D,yDAAyD;SAC1D;KACF;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,OAAyB;IACjD,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,eAAe,EAAE,CAAC;IACpB,CAAC;IAED,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,MAAM,CAAC,2BAA2B,CAAC,CAAC;IACxE,OAAO,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["/* Generic PHP integration — auto-discovered by registry */\nimport type { FrameworkConfig } from '../../lib/framework-config.js';\nimport type { InstallerOptions } from '../../utils/types.js';\nimport { enableDebugLogs } from '../../utils/debug.js';\n\nexport const config: FrameworkConfig = {\n metadata: {\n name: 'PHP',\n integration: 'php',\n docsUrl: 'https://github.com/workos/workos-php',\n skillName: 'workos-php',\n language: 'php',\n stability: 'experimental',\n priority: 44,\n packageManager: 'composer',\n manifestFile: 'composer.json',\n },\n\n detection: {\n packageName: 'php',\n packageDisplayName: 'PHP',\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: () => ({}),\n },\n\n prompts: {},\n\n ui: {\n successMessage: 'WorkOS AuthKit integration complete',\n getOutroChanges: () => [\n 'Analyzed your PHP project structure',\n 'Installed and configured WorkOS PHP SDK',\n 'Created authentication endpoint files',\n ],\n getOutroNextSteps: () => [\n 'Start your PHP development server to test authentication',\n 'Visit the WorkOS Dashboard to manage users and settings',\n ],\n },\n};\n\nexport async function run(options: InstallerOptions): Promise<string> {\n if (options.debug) {\n enableDebugLogs();\n }\n\n const { runAgentInstaller } = await import('../../lib/agent-runner.js');\n return runAgentInstaller(config, options);\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { FrameworkConfig } from '../../lib/framework-config.js';
2
+ import type { InstallerOptions } from '../../utils/types.js';
3
+ export declare const config: FrameworkConfig;
4
+ export declare function run(options: InstallerOptions): Promise<string>;
@@ -0,0 +1,51 @@
1
+ import { enableDebugLogs } from '../../utils/debug.js';
2
+ export const config = {
3
+ metadata: {
4
+ name: 'PHP (Laravel)',
5
+ integration: 'php-laravel',
6
+ docsUrl: 'https://github.com/workos/workos-php-laravel',
7
+ skillName: 'workos-php-laravel',
8
+ language: 'php',
9
+ stability: 'experimental',
10
+ priority: 45,
11
+ packageManager: 'composer',
12
+ manifestFile: 'composer.json',
13
+ },
14
+ detection: {
15
+ packageName: 'laravel/framework',
16
+ packageDisplayName: 'Laravel',
17
+ getVersion: (packageJson) => packageJson?.require?.['laravel/framework'],
18
+ },
19
+ environment: {
20
+ uploadToHosting: false,
21
+ requiresApiKey: true,
22
+ getEnvVars: (apiKey, clientId) => ({
23
+ WORKOS_API_KEY: apiKey,
24
+ WORKOS_CLIENT_ID: clientId,
25
+ }),
26
+ },
27
+ analytics: {
28
+ getTags: () => ({}),
29
+ },
30
+ prompts: {},
31
+ ui: {
32
+ successMessage: 'WorkOS AuthKit integration complete',
33
+ getOutroChanges: () => [
34
+ 'Analyzed your Laravel project structure',
35
+ 'Installed and configured WorkOS AuthKit Laravel SDK',
36
+ 'Created authentication controller and routes',
37
+ ],
38
+ getOutroNextSteps: () => [
39
+ 'Run `php artisan serve` to test authentication',
40
+ 'Visit the WorkOS Dashboard to manage users and settings',
41
+ ],
42
+ },
43
+ };
44
+ export async function run(options) {
45
+ if (options.debug) {
46
+ enableDebugLogs();
47
+ }
48
+ const { runAgentInstaller } = await import('../../lib/agent-runner.js');
49
+ return runAgentInstaller(config, options);
50
+ }
51
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/integrations/php-laravel/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,CAAC,MAAM,MAAM,GAAoB;IACrC,QAAQ,EAAE;QACR,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,aAAa;QAC1B,OAAO,EAAE,8CAA8C;QACvD,SAAS,EAAE,oBAAoB;QAC/B,QAAQ,EAAE,KAAK;QACf,SAAS,EAAE,cAAc;QACzB,QAAQ,EAAE,EAAE;QACZ,cAAc,EAAE,UAAU;QAC1B,YAAY,EAAE,eAAe;KAC9B;IAED,SAAS,EAAE;QACT,WAAW,EAAE,mBAAmB;QAChC,kBAAkB,EAAE,SAAS;QAC7B,UAAU,EAAE,CAAC,WAAgB,EAAE,EAAE,CAAC,WAAW,EAAE,OAAO,EAAE,CAAC,mBAAmB,CAAC;KAC9E;IAED,WAAW,EAAE;QACX,eAAe,EAAE,KAAK;QACtB,cAAc,EAAE,IAAI;QACpB,UAAU,EAAE,CAAC,MAAc,EAAE,QAAgB,EAAE,EAAE,CAAC,CAAC;YACjD,cAAc,EAAE,MAAM;YACtB,gBAAgB,EAAE,QAAQ;SAC3B,CAAC;KACH;IAED,SAAS,EAAE;QACT,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;KACpB;IAED,OAAO,EAAE,EAAE;IAEX,EAAE,EAAE;QACF,cAAc,EAAE,qCAAqC;QACrD,eAAe,EAAE,GAAG,EAAE,CAAC;YACrB,yCAAyC;YACzC,qDAAqD;YACrD,8CAA8C;SAC/C;QACD,iBAAiB,EAAE,GAAG,EAAE,CAAC;YACvB,gDAAgD;YAChD,yDAAyD;SAC1D;KACF;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,OAAyB;IACjD,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,eAAe,EAAE,CAAC;IACpB,CAAC;IAED,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,MAAM,CAAC,2BAA2B,CAAC,CAAC;IACxE,OAAO,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["/* PHP Laravel integration — auto-discovered by registry */\nimport type { FrameworkConfig } from '../../lib/framework-config.js';\nimport type { InstallerOptions } from '../../utils/types.js';\nimport { enableDebugLogs } from '../../utils/debug.js';\n\nexport const config: FrameworkConfig = {\n metadata: {\n name: 'PHP (Laravel)',\n integration: 'php-laravel',\n docsUrl: 'https://github.com/workos/workos-php-laravel',\n skillName: 'workos-php-laravel',\n language: 'php',\n stability: 'experimental',\n priority: 45,\n packageManager: 'composer',\n manifestFile: 'composer.json',\n },\n\n detection: {\n packageName: 'laravel/framework',\n packageDisplayName: 'Laravel',\n getVersion: (packageJson: any) => packageJson?.require?.['laravel/framework'],\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: () => ({}),\n },\n\n prompts: {},\n\n ui: {\n successMessage: 'WorkOS AuthKit integration complete',\n getOutroChanges: () => [\n 'Analyzed your Laravel project structure',\n 'Installed and configured WorkOS AuthKit Laravel SDK',\n 'Created authentication controller and routes',\n ],\n getOutroNextSteps: () => [\n 'Run `php artisan serve` to test authentication',\n 'Visit the WorkOS Dashboard to manage users and settings',\n ],\n },\n};\n\nexport async function run(options: InstallerOptions): Promise<string> {\n if (options.debug) {\n enableDebugLogs();\n }\n\n const { runAgentInstaller } = await import('../../lib/agent-runner.js');\n return runAgentInstaller(config, options);\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import type { FrameworkConfig } from '../../lib/framework-config.js';
2
+ import type { InstallerOptions } from '../../utils/types.js';
3
+ export declare const config: FrameworkConfig;
4
+ /**
5
+ * Custom run function that bypasses runAgentInstaller.
6
+ * Calls initializeAgent + runAgent directly, handling Python-specific
7
+ * env writing and prompt building.
8
+ */
9
+ export declare function run(options: InstallerOptions): Promise<string>;
@@ -0,0 +1,254 @@
1
+ /* Python/Django integration — auto-discovered by registry */
2
+ import { existsSync, readFileSync, writeFileSync } from 'node:fs';
3
+ import { join } from 'node:path';
4
+ import { enableDebugLogs } from '../../utils/debug.js';
5
+ import { analytics } from '../../utils/analytics.js';
6
+ import { INSTALLER_INTERACTION_EVENT_NAME } from '../../lib/constants.js';
7
+ import { parseEnvFile } from '../../utils/env-parser.js';
8
+ /**
9
+ * Detect which Python package manager the project uses.
10
+ */
11
+ function detectPythonPackageManager(installDir) {
12
+ if (existsSync(join(installDir, 'uv.lock'))) {
13
+ return { name: 'uv', installCmd: 'uv add' };
14
+ }
15
+ if (existsSync(join(installDir, 'pyproject.toml'))) {
16
+ try {
17
+ const content = readFileSync(join(installDir, 'pyproject.toml'), 'utf-8');
18
+ if (content.includes('[tool.poetry]')) {
19
+ return { name: 'poetry', installCmd: 'poetry add' };
20
+ }
21
+ }
22
+ catch {
23
+ /* ignore */
24
+ }
25
+ }
26
+ if (existsSync(join(installDir, 'Pipfile'))) {
27
+ return { name: 'pipenv', installCmd: 'pipenv install' };
28
+ }
29
+ return { name: 'pip', installCmd: 'pip install' };
30
+ }
31
+ /**
32
+ * Detect if this is a Django project.
33
+ */
34
+ function isDjangoProject(installDir) {
35
+ if (existsSync(join(installDir, 'manage.py')))
36
+ return true;
37
+ const pyprojectPath = join(installDir, 'pyproject.toml');
38
+ if (existsSync(pyprojectPath)) {
39
+ try {
40
+ const content = readFileSync(pyprojectPath, 'utf-8');
41
+ if (/django/i.test(content))
42
+ return true;
43
+ }
44
+ catch {
45
+ /* ignore */
46
+ }
47
+ }
48
+ const reqPath = join(installDir, 'requirements.txt');
49
+ if (existsSync(reqPath)) {
50
+ try {
51
+ const content = readFileSync(reqPath, 'utf-8');
52
+ if (/^django/im.test(content))
53
+ return true;
54
+ }
55
+ catch {
56
+ /* ignore */
57
+ }
58
+ }
59
+ return false;
60
+ }
61
+ /**
62
+ * Write .env file for Python projects (not .env.local).
63
+ * Merges with existing .env. No cookie password generation.
64
+ */
65
+ function writeEnvFile(installDir, envVars) {
66
+ const envPath = join(installDir, '.env');
67
+ let existingEnv = {};
68
+ if (existsSync(envPath)) {
69
+ try {
70
+ existingEnv = parseEnvFile(readFileSync(envPath, 'utf-8'));
71
+ }
72
+ catch {
73
+ /* ignore */
74
+ }
75
+ }
76
+ const merged = { ...existingEnv, ...envVars };
77
+ const content = Object.entries(merged)
78
+ .map(([key, value]) => `${key}=${value}`)
79
+ .join('\n');
80
+ writeFileSync(envPath, content + '\n');
81
+ }
82
+ export const config = {
83
+ metadata: {
84
+ name: 'Python (Django)',
85
+ integration: 'python',
86
+ docsUrl: 'https://workos.com/docs/user-management/authkit/vanilla/python',
87
+ skillName: 'workos-python',
88
+ language: 'python',
89
+ stability: 'experimental',
90
+ priority: 60,
91
+ packageManager: 'pip',
92
+ manifestFile: 'pyproject.toml',
93
+ gatherContext: async (options) => {
94
+ const pkgMgr = detectPythonPackageManager(options.installDir);
95
+ return {
96
+ packageManager: pkgMgr.name,
97
+ installCommand: pkgMgr.installCmd,
98
+ isDjango: isDjangoProject(options.installDir),
99
+ };
100
+ },
101
+ },
102
+ detection: {
103
+ // Dummy values for FrameworkDetection interface compat — Python doesn't use package.json
104
+ packageName: 'workos',
105
+ packageDisplayName: 'Python (Django)',
106
+ getVersion: () => undefined,
107
+ },
108
+ environment: {
109
+ uploadToHosting: false,
110
+ requiresApiKey: true,
111
+ getEnvVars: (apiKey, clientId) => ({
112
+ WORKOS_API_KEY: apiKey,
113
+ WORKOS_CLIENT_ID: clientId,
114
+ }),
115
+ },
116
+ analytics: {
117
+ getTags: (context) => ({
118
+ 'python-package-manager': context?.packageManager || 'unknown',
119
+ 'python-is-django': String(context?.isDjango ?? false),
120
+ }),
121
+ },
122
+ prompts: {
123
+ getAdditionalContextLines: (context) => {
124
+ const lines = [];
125
+ if (context?.packageManager)
126
+ lines.push(`Package manager: ${context.packageManager}`);
127
+ if (context?.installCommand)
128
+ lines.push(`Install command: ${context.installCommand}`);
129
+ if (context?.isDjango)
130
+ lines.push('Framework: Django');
131
+ return lines;
132
+ },
133
+ },
134
+ ui: {
135
+ successMessage: 'WorkOS AuthKit integration complete',
136
+ getOutroChanges: () => [
137
+ 'Analyzed your Python/Django project structure',
138
+ 'Installed WorkOS Python SDK',
139
+ 'Created authentication views (login, callback, logout)',
140
+ 'Configured URL routing and environment variables',
141
+ ],
142
+ getOutroNextSteps: () => [
143
+ 'Run `python manage.py runserver` to test authentication',
144
+ 'Visit http://localhost:8000/auth/login to test the login flow',
145
+ 'Visit the WorkOS Dashboard to manage users and settings',
146
+ ],
147
+ },
148
+ };
149
+ /**
150
+ * Build the agent prompt for Python/Django integration.
151
+ */
152
+ function buildPythonPrompt(frameworkContext) {
153
+ const contextLines = ['- Framework: Python (Django)'];
154
+ if (frameworkContext.packageManager)
155
+ contextLines.push(`- Package manager: ${frameworkContext.packageManager}`);
156
+ if (frameworkContext.installCommand)
157
+ contextLines.push(`- Install command: ${frameworkContext.installCommand}`);
158
+ const skillName = config.metadata.skillName;
159
+ return `You are integrating WorkOS AuthKit into this Python/Django application.
160
+
161
+ ## Project Context
162
+
163
+ ${contextLines.join('\n')}
164
+
165
+ ## Environment
166
+
167
+ The following environment variables have been configured in .env:
168
+ - WORKOS_API_KEY
169
+ - WORKOS_CLIENT_ID
170
+
171
+ ## Your Task
172
+
173
+ Use the \`${skillName}\` skill to integrate WorkOS AuthKit into this application.
174
+
175
+ The skill contains step-by-step instructions including:
176
+ 1. Fetching the SDK documentation
177
+ 2. Installing the SDK and python-dotenv
178
+ 3. Configuring Django settings
179
+ 4. Creating authentication views
180
+ 5. Setting up URL routing
181
+ 6. Adding authentication UI
182
+
183
+ Report your progress using [STATUS] prefixes.
184
+
185
+ Begin by invoking the ${skillName} skill.`;
186
+ }
187
+ /**
188
+ * Custom run function that bypasses runAgentInstaller.
189
+ * Calls initializeAgent + runAgent directly, handling Python-specific
190
+ * env writing and prompt building.
191
+ */
192
+ export async function run(options) {
193
+ if (options.debug) {
194
+ enableDebugLogs();
195
+ }
196
+ options.emitter?.emit('status', {
197
+ message: 'Setting up WorkOS AuthKit for Python (Django)',
198
+ });
199
+ const apiKey = options.apiKey || '';
200
+ const clientId = options.clientId || '';
201
+ // Gather Python-specific context
202
+ const frameworkContext = config.metadata.gatherContext ? await config.metadata.gatherContext(options) : {};
203
+ analytics.capture(INSTALLER_INTERACTION_EVENT_NAME, {
204
+ action: 'started agent integration',
205
+ integration: 'python',
206
+ });
207
+ // Set analytics tags
208
+ const contextTags = config.analytics.getTags(frameworkContext);
209
+ for (const [key, value] of Object.entries(contextTags)) {
210
+ analytics.setTag(key, value);
211
+ }
212
+ // Write .env (not .env.local) with WorkOS credentials
213
+ writeEnvFile(options.installDir, {
214
+ ...(apiKey ? { WORKOS_API_KEY: apiKey } : {}),
215
+ WORKOS_CLIENT_ID: clientId,
216
+ });
217
+ // Build Python-specific prompt
218
+ const prompt = buildPythonPrompt(frameworkContext);
219
+ // Initialize and run agent directly (bypass runAgentInstaller)
220
+ const { initializeAgent, runAgent } = await import('../../lib/agent-interface.js');
221
+ const agentConfig = await initializeAgent({
222
+ workingDirectory: options.installDir,
223
+ workOSApiKey: apiKey,
224
+ workOSApiHost: 'https://api.workos.com',
225
+ }, options);
226
+ const result = await runAgent(agentConfig, prompt, options, {
227
+ spinnerMessage: 'Setting up WorkOS AuthKit for Python/Django...',
228
+ successMessage: config.ui.successMessage,
229
+ errorMessage: 'Python integration failed',
230
+ }, options.emitter);
231
+ if (result.error) {
232
+ await analytics.shutdown('error');
233
+ throw new Error(`Agent error: ${result.errorMessage || result.error}`);
234
+ }
235
+ // Build completion summary
236
+ const changes = config.ui.getOutroChanges({});
237
+ const nextSteps = config.ui.getOutroNextSteps({});
238
+ const lines = [
239
+ 'Successfully installed WorkOS AuthKit!',
240
+ '',
241
+ 'What the agent did:',
242
+ ...changes.map((c) => `• ${c}`),
243
+ '',
244
+ 'Next steps:',
245
+ ...nextSteps.map((s) => `• ${s}`),
246
+ '',
247
+ `Learn more: ${config.metadata.docsUrl}`,
248
+ '',
249
+ 'Note: This installer uses an LLM agent to analyze and modify your project. Please review the changes made.',
250
+ ];
251
+ await analytics.shutdown('success');
252
+ return lines.join('\n');
253
+ }
254
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/integrations/python/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,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,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD;;GAEG;AACH,SAAS,0BAA0B,CAAC,UAAkB;IACpD,IAAI,UAAU,CAAC,IAAI,CAAC,UAAU,EAAE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,CAC3B,WAAW,EACX,MAAM,EACN,OAAO,EACP;QACE,cAAc,EAAE,gDAAgD;QAChE,cAAc,EAAE,MAAM,CAAC,EAAE,CAAC,cAAc;QACxC,YAAY,EAAE,2BAA2B;KAC1C,EACD,OAAO,CAAC,OAAO,CAChB,CAAC;IAEF,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,MAAM,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,gBAAgB,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;IACzE,CAAC;IAED,2BAA2B;IAC3B,MAAM,OAAO,GAAG,MAAM,CAAC,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IAC9C,MAAM,SAAS,GAAG,MAAM,CAAC,EAAE,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;IAElD,MAAM,KAAK,GAAa;QACtB,wCAAwC;QACxC,EAAE;QACF,qBAAqB;QACrB,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,EAAE;QACF,aAAa;QACb,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;QACjC,EAAE;QACF,eAAe,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE;QACxC,EAAE;QACF,4GAA4G;KAC7G,CAAC;IAEF,MAAM,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACpC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["/* Python/Django 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 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 { parseEnvFile } from '../../utils/env-parser.js';\n\n/**\n * Detect which Python package manager the project uses.\n */\nfunction detectPythonPackageManager(installDir: string): { name: string; installCmd: string } {\n if (existsSync(join(installDir, 'uv.lock'))) {\n return { name: 'uv', installCmd: 'uv add' };\n }\n\n if (existsSync(join(installDir, 'pyproject.toml'))) {\n try {\n const content = readFileSync(join(installDir, 'pyproject.toml'), 'utf-8');\n if (content.includes('[tool.poetry]')) {\n return { name: 'poetry', installCmd: 'poetry add' };\n }\n } catch {\n /* ignore */\n }\n }\n\n if (existsSync(join(installDir, 'Pipfile'))) {\n return { name: 'pipenv', installCmd: 'pipenv install' };\n }\n\n return { name: 'pip', installCmd: 'pip install' };\n}\n\n/**\n * Detect if this is a Django project.\n */\nfunction isDjangoProject(installDir: string): boolean {\n if (existsSync(join(installDir, 'manage.py'))) return true;\n\n const pyprojectPath = join(installDir, 'pyproject.toml');\n if (existsSync(pyprojectPath)) {\n try {\n const content = readFileSync(pyprojectPath, 'utf-8');\n if (/django/i.test(content)) return true;\n } catch {\n /* ignore */\n }\n }\n\n const reqPath = join(installDir, 'requirements.txt');\n if (existsSync(reqPath)) {\n try {\n const content = readFileSync(reqPath, 'utf-8');\n if (/^django/im.test(content)) return true;\n } catch {\n /* ignore */\n }\n }\n\n return false;\n}\n\n/**\n * Write .env file for Python projects (not .env.local).\n * Merges with existing .env. No cookie password generation.\n */\nfunction writeEnvFile(installDir: string, envVars: Record<string, string>): void {\n const envPath = join(installDir, '.env');\n\n let existingEnv: Record<string, string> = {};\n if (existsSync(envPath)) {\n try {\n existingEnv = parseEnvFile(readFileSync(envPath, 'utf-8'));\n } catch {\n /* ignore */\n }\n }\n\n const merged = { ...existingEnv, ...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: 'Python (Django)',\n integration: 'python',\n docsUrl: 'https://workos.com/docs/user-management/authkit/vanilla/python',\n skillName: 'workos-python',\n language: 'python',\n stability: 'experimental',\n priority: 60,\n packageManager: 'pip',\n manifestFile: 'pyproject.toml',\n gatherContext: async (options: InstallerOptions) => {\n const pkgMgr = detectPythonPackageManager(options.installDir);\n return {\n packageManager: pkgMgr.name,\n installCommand: pkgMgr.installCmd,\n isDjango: isDjangoProject(options.installDir),\n };\n },\n },\n\n detection: {\n // Dummy values for FrameworkDetection interface compat — Python doesn't use package.json\n packageName: 'workos',\n packageDisplayName: 'Python (Django)',\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) => ({\n 'python-package-manager': context?.packageManager || 'unknown',\n 'python-is-django': String(context?.isDjango ?? false),\n }),\n },\n\n prompts: {\n getAdditionalContextLines: (context: any) => {\n const lines: string[] = [];\n if (context?.packageManager) lines.push(`Package manager: ${context.packageManager}`);\n if (context?.installCommand) lines.push(`Install command: ${context.installCommand}`);\n if (context?.isDjango) lines.push('Framework: Django');\n return lines;\n },\n },\n\n ui: {\n successMessage: 'WorkOS AuthKit integration complete',\n getOutroChanges: () => [\n 'Analyzed your Python/Django project structure',\n 'Installed WorkOS Python SDK',\n 'Created authentication views (login, callback, logout)',\n 'Configured URL routing and environment variables',\n ],\n getOutroNextSteps: () => [\n 'Run `python manage.py runserver` to test authentication',\n 'Visit http://localhost:8000/auth/login to test the login flow',\n 'Visit the WorkOS Dashboard to manage users and settings',\n ],\n },\n};\n\n/**\n * Build the agent prompt for Python/Django integration.\n */\nfunction buildPythonPrompt(frameworkContext: Record<string, any>): string {\n const contextLines = ['- Framework: Python (Django)'];\n if (frameworkContext.packageManager) contextLines.push(`- Package manager: ${frameworkContext.packageManager}`);\n if (frameworkContext.installCommand) contextLines.push(`- Install command: ${frameworkContext.installCommand}`);\n\n const skillName = config.metadata.skillName!;\n\n return `You are integrating WorkOS AuthKit into this Python/Django application.\n\n## Project Context\n\n${contextLines.join('\\n')}\n\n## Environment\n\nThe following environment variables have been configured in .env:\n- WORKOS_API_KEY\n- WORKOS_CLIENT_ID\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 and python-dotenv\n3. Configuring Django settings\n4. Creating authentication views\n5. Setting up URL routing\n6. Adding authentication UI\n\nReport your progress using [STATUS] prefixes.\n\nBegin by invoking the ${skillName} skill.`;\n}\n\n/**\n * Custom run function that bypasses runAgentInstaller.\n * Calls initializeAgent + runAgent directly, handling Python-specific\n * env writing and prompt building.\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 Python (Django)',\n });\n\n const apiKey = options.apiKey || '';\n const clientId = options.clientId || '';\n\n // Gather Python-specific context\n const frameworkContext = config.metadata.gatherContext ? await config.metadata.gatherContext(options) : {};\n\n analytics.capture(INSTALLER_INTERACTION_EVENT_NAME, {\n action: 'started agent integration',\n integration: 'python',\n });\n\n // Set analytics tags\n const contextTags = config.analytics.getTags(frameworkContext);\n for (const [key, value] of Object.entries(contextTags)) {\n analytics.setTag(key, value);\n }\n\n // Write .env (not .env.local) with WorkOS credentials\n writeEnvFile(options.installDir, {\n ...(apiKey ? { WORKOS_API_KEY: apiKey } : {}),\n WORKOS_CLIENT_ID: clientId,\n });\n\n // Build Python-specific prompt\n const prompt = buildPythonPrompt(frameworkContext);\n\n // Initialize and run agent directly (bypass runAgentInstaller)\n const { initializeAgent, runAgent } = await import('../../lib/agent-interface.js');\n\n const agentConfig = await initializeAgent(\n {\n workingDirectory: options.installDir,\n workOSApiKey: apiKey,\n workOSApiHost: 'https://api.workos.com',\n },\n options,\n );\n\n const result = await runAgent(\n agentConfig,\n prompt,\n options,\n {\n spinnerMessage: 'Setting up WorkOS AuthKit for Python/Django...',\n successMessage: config.ui.successMessage,\n errorMessage: 'Python integration failed',\n },\n options.emitter,\n );\n\n if (result.error) {\n await analytics.shutdown('error');\n throw new Error(`Agent error: ${result.errorMessage || result.error}`);\n }\n\n // Build completion summary\n const changes = config.ui.getOutroChanges({});\n const nextSteps = config.ui.getOutroNextSteps({});\n\n const lines: string[] = [\n 'Successfully installed WorkOS AuthKit!',\n '',\n 'What the agent did:',\n ...changes.map((c) => `• ${c}`),\n '',\n 'Next steps:',\n ...nextSteps.map((s) => `• ${s}`),\n '',\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 return lines.join('\\n');\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { FrameworkConfig } from '../../lib/framework-config.js';
2
+ import type { InstallerOptions } from '../../utils/types.js';
3
+ export declare const config: FrameworkConfig;
4
+ export declare function run(options: InstallerOptions): Promise<string>;
@@ -0,0 +1,49 @@
1
+ import { enableDebugLogs } from '../../utils/debug.js';
2
+ export const config = {
3
+ metadata: {
4
+ name: 'React (SPA)',
5
+ integration: 'react',
6
+ docsUrl: 'https://workos.com/docs/user-management/authkit/react',
7
+ unsupportedVersionDocsUrl: 'https://workos.com/docs/user-management/authkit/react',
8
+ skillName: 'workos-authkit-react',
9
+ language: 'javascript',
10
+ stability: 'stable',
11
+ priority: 70,
12
+ },
13
+ detection: {
14
+ packageName: 'react',
15
+ packageDisplayName: 'React',
16
+ getVersion: (packageJson) => packageJson.dependencies?.react || packageJson.devDependencies?.react,
17
+ },
18
+ environment: {
19
+ uploadToHosting: false,
20
+ requiresApiKey: false,
21
+ getEnvVars: (_apiKey, clientId) => ({
22
+ WORKOS_CLIENT_ID: clientId,
23
+ }),
24
+ },
25
+ analytics: {
26
+ getTags: () => ({}),
27
+ },
28
+ prompts: {},
29
+ ui: {
30
+ successMessage: 'WorkOS AuthKit integration complete',
31
+ getOutroChanges: () => [
32
+ 'Analyzed your React project structure',
33
+ 'Created and configured WorkOS AuthKit',
34
+ 'Integrated authentication into your application',
35
+ ],
36
+ getOutroNextSteps: () => [
37
+ 'Start your development server to test authentication',
38
+ 'Visit the WorkOS Dashboard to manage users and settings',
39
+ ],
40
+ },
41
+ };
42
+ export async function run(options) {
43
+ if (options.debug) {
44
+ enableDebugLogs();
45
+ }
46
+ const { runAgentInstaller } = await import('../../lib/agent-runner.js');
47
+ return runAgentInstaller(config, options);
48
+ }
49
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/integrations/react/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,CAAC,MAAM,MAAM,GAAoB;IACrC,QAAQ,EAAE;QACR,IAAI,EAAE,aAAa;QACnB,WAAW,EAAE,OAAO;QACpB,OAAO,EAAE,uDAAuD;QAChE,yBAAyB,EAAE,uDAAuD;QAClF,SAAS,EAAE,sBAAsB;QACjC,QAAQ,EAAE,YAAY;QACtB,SAAS,EAAE,QAAQ;QACnB,QAAQ,EAAE,EAAE;KACb;IAED,SAAS,EAAE;QACT,WAAW,EAAE,OAAO;QACpB,kBAAkB,EAAE,OAAO;QAC3B,UAAU,EAAE,CAAC,WAAgB,EAAE,EAAE,CAAC,WAAW,CAAC,YAAY,EAAE,KAAK,IAAI,WAAW,CAAC,eAAe,EAAE,KAAK;KACxG;IAED,WAAW,EAAE;QACX,eAAe,EAAE,KAAK;QACtB,cAAc,EAAE,KAAK;QACrB,UAAU,EAAE,CAAC,OAAe,EAAE,QAAgB,EAAE,EAAE,CAAC,CAAC;YAClD,gBAAgB,EAAE,QAAQ;SAC3B,CAAC;KACH;IAED,SAAS,EAAE;QACT,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;KACpB;IAED,OAAO,EAAE,EAAE;IAEX,EAAE,EAAE;QACF,cAAc,EAAE,qCAAqC;QACrD,eAAe,EAAE,GAAG,EAAE,CAAC;YACrB,uCAAuC;YACvC,uCAAuC;YACvC,iDAAiD;SAClD;QACD,iBAAiB,EAAE,GAAG,EAAE,CAAC;YACvB,sDAAsD;YACtD,yDAAyD;SAC1D;KACF;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,OAAyB;IACjD,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,eAAe,EAAE,CAAC;IACpB,CAAC;IAED,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,MAAM,CAAC,2BAA2B,CAAC,CAAC;IACxE,OAAO,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["/* React SPA integration — auto-discovered by registry */\nimport type { FrameworkConfig } from '../../lib/framework-config.js';\nimport type { InstallerOptions } from '../../utils/types.js';\nimport { enableDebugLogs } from '../../utils/debug.js';\n\nexport const config: FrameworkConfig = {\n metadata: {\n name: 'React (SPA)',\n integration: 'react',\n docsUrl: 'https://workos.com/docs/user-management/authkit/react',\n unsupportedVersionDocsUrl: 'https://workos.com/docs/user-management/authkit/react',\n skillName: 'workos-authkit-react',\n language: 'javascript',\n stability: 'stable',\n priority: 70,\n },\n\n detection: {\n packageName: 'react',\n packageDisplayName: 'React',\n getVersion: (packageJson: any) => packageJson.dependencies?.react || packageJson.devDependencies?.react,\n },\n\n environment: {\n uploadToHosting: false,\n requiresApiKey: false,\n getEnvVars: (_apiKey: string, clientId: string) => ({\n WORKOS_CLIENT_ID: clientId,\n }),\n },\n\n analytics: {\n getTags: () => ({}),\n },\n\n prompts: {},\n\n ui: {\n successMessage: 'WorkOS AuthKit integration complete',\n getOutroChanges: () => [\n 'Analyzed your React project structure',\n 'Created and configured WorkOS AuthKit',\n 'Integrated authentication into your application',\n ],\n getOutroNextSteps: () => [\n 'Start your development server to test authentication',\n 'Visit the WorkOS Dashboard to manage users and settings',\n ],\n },\n};\n\nexport async function run(options: InstallerOptions): Promise<string> {\n if (options.debug) {\n enableDebugLogs();\n }\n\n const { runAgentInstaller } = await import('../../lib/agent-runner.js');\n return runAgentInstaller(config, options);\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { FrameworkConfig } from '../../lib/framework-config.js';
2
+ import type { InstallerOptions } from '../../utils/types.js';
3
+ export declare const config: FrameworkConfig;
4
+ export declare function run(options: InstallerOptions): Promise<string>;
@@ -0,0 +1,94 @@
1
+ import { enableDebugLogs } from '../../utils/debug.js';
2
+ import { getPackageVersion } from '../../utils/package-json.js';
3
+ import { getPackageDotJson } from '../../utils/clack-utils.js';
4
+ import clack from '../../utils/clack.js';
5
+ import chalk from 'chalk';
6
+ import * as semver from 'semver';
7
+ import { getReactRouterMode, getReactRouterModeName, getReactRouterVersionBucket, ReactRouterMode } from './utils.js';
8
+ const MINIMUM_REACT_ROUTER_VERSION = '6.0.0';
9
+ export const config = {
10
+ metadata: {
11
+ name: 'React Router',
12
+ integration: 'react-router',
13
+ docsUrl: 'https://workos.com/docs/user-management/authkit/react-router',
14
+ unsupportedVersionDocsUrl: 'https://workos.com/docs/user-management/authkit/react-router',
15
+ skillName: 'workos-authkit-react-router',
16
+ language: 'javascript',
17
+ stability: 'stable',
18
+ priority: 80,
19
+ gatherContext: async (options) => {
20
+ const routerMode = await getReactRouterMode(options);
21
+ return { routerMode };
22
+ },
23
+ },
24
+ detection: {
25
+ packageName: 'react-router',
26
+ packageDisplayName: 'React Router',
27
+ getVersion: (packageJson) => getPackageVersion('react-router', packageJson),
28
+ getVersionBucket: getReactRouterVersionBucket,
29
+ },
30
+ environment: {
31
+ uploadToHosting: false,
32
+ requiresApiKey: true,
33
+ getEnvVars: (apiKey, clientId) => ({
34
+ WORKOS_API_KEY: apiKey,
35
+ WORKOS_CLIENT_ID: clientId,
36
+ }),
37
+ },
38
+ analytics: {
39
+ getTags: (context) => {
40
+ const routerMode = context.routerMode;
41
+ return { routerMode: routerMode || 'unknown' };
42
+ },
43
+ },
44
+ prompts: {
45
+ getAdditionalContextLines: (context) => {
46
+ const routerMode = context.routerMode;
47
+ const modeName = routerMode ? getReactRouterModeName(routerMode) : 'unknown';
48
+ const frameworkIdMap = {
49
+ [ReactRouterMode.V6]: 'react-react-router-6',
50
+ [ReactRouterMode.V7_FRAMEWORK]: 'react-react-router-7-framework',
51
+ [ReactRouterMode.V7_DATA]: 'react-react-router-7-data',
52
+ [ReactRouterMode.V7_DECLARATIVE]: 'react-react-router-7-declarative',
53
+ };
54
+ const frameworkId = routerMode ? frameworkIdMap[routerMode] : ReactRouterMode.V7_FRAMEWORK;
55
+ return [`Router mode: ${modeName}`, `Framework docs ID: ${frameworkId}`];
56
+ },
57
+ },
58
+ ui: {
59
+ successMessage: 'WorkOS AuthKit integration complete',
60
+ getOutroChanges: (context) => {
61
+ const routerMode = context.routerMode;
62
+ const modeName = routerMode ? getReactRouterModeName(routerMode) : 'React Router';
63
+ return [
64
+ `Analyzed your React Router project structure (${modeName})`,
65
+ `Created and configured WorkOS AuthKit`,
66
+ `Integrated authentication into your application`,
67
+ ];
68
+ },
69
+ getOutroNextSteps: () => [
70
+ 'Start your development server to test authentication',
71
+ 'Visit the WorkOS Dashboard to manage users and settings',
72
+ ],
73
+ },
74
+ };
75
+ export async function run(options) {
76
+ if (options.debug) {
77
+ enableDebugLogs();
78
+ }
79
+ const packageJson = await getPackageDotJson(options);
80
+ const reactRouterVersion = getPackageVersion('react-router', packageJson);
81
+ if (reactRouterVersion) {
82
+ const coercedVersion = semver.coerce(reactRouterVersion);
83
+ if (coercedVersion && semver.lt(coercedVersion, MINIMUM_REACT_ROUTER_VERSION)) {
84
+ const docsUrl = config.metadata.unsupportedVersionDocsUrl ?? config.metadata.docsUrl;
85
+ clack.log.warn(`Sorry: the installer can't help you with React Router ${reactRouterVersion}. Upgrade to React Router ${MINIMUM_REACT_ROUTER_VERSION} or later, or check out the manual setup guide.`);
86
+ clack.log.info(`Setup React Router manually: ${chalk.cyan(docsUrl)}`);
87
+ clack.outro('WorkOS AuthKit installer will see you next time!');
88
+ return '';
89
+ }
90
+ }
91
+ const { runAgentInstaller } = await import('../../lib/agent-runner.js');
92
+ return runAgentInstaller(config, options);
93
+ }
94
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/integrations/react-router/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,MAAM,sBAAsB,CAAC;AACzC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEtH,MAAM,4BAA4B,GAAG,OAAO,CAAC;AAE7C,MAAM,CAAC,MAAM,MAAM,GAAoB;IACrC,QAAQ,EAAE;QACR,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,cAAc;QAC3B,OAAO,EAAE,8DAA8D;QACvE,yBAAyB,EAAE,8DAA8D;QACzF,SAAS,EAAE,6BAA6B;QACxC,QAAQ,EAAE,YAAY;QACtB,SAAS,EAAE,QAAQ;QACnB,QAAQ,EAAE,EAAE;QACZ,aAAa,EAAE,KAAK,EAAE,OAAyB,EAAE,EAAE;YACjD,MAAM,UAAU,GAAG,MAAM,kBAAkB,CAAC,OAAO,CAAC,CAAC;YACrD,OAAO,EAAE,UAAU,EAAE,CAAC;QACxB,CAAC;KACF;IAED,SAAS,EAAE;QACT,WAAW,EAAE,cAA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QACZ,CAAC;IACH,CAAC;IAED,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,MAAM,CAAC,2BAA2B,CAAC,CAAC;IACxE,OAAO,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["/* React Router integration — auto-discovered by registry */\nimport type { FrameworkConfig } from '../../lib/framework-config.js';\nimport type { InstallerOptions } from '../../utils/types.js';\nimport { enableDebugLogs } from '../../utils/debug.js';\nimport { getPackageVersion } from '../../utils/package-json.js';\nimport { getPackageDotJson } from '../../utils/clack-utils.js';\nimport clack from '../../utils/clack.js';\nimport chalk from 'chalk';\nimport * as semver from 'semver';\nimport { getReactRouterMode, getReactRouterModeName, getReactRouterVersionBucket, ReactRouterMode } from './utils.js';\n\nconst MINIMUM_REACT_ROUTER_VERSION = '6.0.0';\n\nexport const config: FrameworkConfig = {\n metadata: {\n name: 'React Router',\n integration: 'react-router',\n docsUrl: 'https://workos.com/docs/user-management/authkit/react-router',\n unsupportedVersionDocsUrl: 'https://workos.com/docs/user-management/authkit/react-router',\n skillName: 'workos-authkit-react-router',\n language: 'javascript',\n stability: 'stable',\n priority: 80,\n gatherContext: async (options: InstallerOptions) => {\n const routerMode = await getReactRouterMode(options);\n return { routerMode };\n },\n },\n\n detection: {\n packageName: 'react-router',\n packageDisplayName: 'React Router',\n getVersion: (packageJson: any) => getPackageVersion('react-router', packageJson),\n getVersionBucket: getReactRouterVersionBucket,\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) => {\n const routerMode = context.routerMode as ReactRouterMode;\n return { routerMode: routerMode || 'unknown' };\n },\n },\n\n prompts: {\n getAdditionalContextLines: (context: any) => {\n const routerMode = context.routerMode as ReactRouterMode;\n const modeName = routerMode ? getReactRouterModeName(routerMode) : 'unknown';\n\n const frameworkIdMap: Record<ReactRouterMode, string> = {\n [ReactRouterMode.V6]: 'react-react-router-6',\n [ReactRouterMode.V7_FRAMEWORK]: 'react-react-router-7-framework',\n [ReactRouterMode.V7_DATA]: 'react-react-router-7-data',\n [ReactRouterMode.V7_DECLARATIVE]: 'react-react-router-7-declarative',\n };\n\n const frameworkId = routerMode ? frameworkIdMap[routerMode] : ReactRouterMode.V7_FRAMEWORK;\n\n return [`Router mode: ${modeName}`, `Framework docs ID: ${frameworkId}`];\n },\n },\n\n ui: {\n successMessage: 'WorkOS AuthKit integration complete',\n getOutroChanges: (context: any) => {\n const routerMode = context.routerMode as ReactRouterMode;\n const modeName = routerMode ? getReactRouterModeName(routerMode) : 'React Router';\n return [\n `Analyzed your React Router project structure (${modeName})`,\n `Created and configured WorkOS AuthKit`,\n `Integrated authentication into your application`,\n ];\n },\n getOutroNextSteps: () => [\n 'Start your development server to test authentication',\n 'Visit the WorkOS Dashboard to manage users and settings',\n ],\n },\n};\n\nexport async function run(options: InstallerOptions): Promise<string> {\n if (options.debug) {\n enableDebugLogs();\n }\n\n const packageJson = await getPackageDotJson(options);\n const reactRouterVersion = getPackageVersion('react-router', packageJson);\n\n if (reactRouterVersion) {\n const coercedVersion = semver.coerce(reactRouterVersion);\n if (coercedVersion && semver.lt(coercedVersion, MINIMUM_REACT_ROUTER_VERSION)) {\n const docsUrl = config.metadata.unsupportedVersionDocsUrl ?? config.metadata.docsUrl;\n\n clack.log.warn(\n `Sorry: the installer can't help you with React Router ${reactRouterVersion}. Upgrade to React Router ${MINIMUM_REACT_ROUTER_VERSION} or later, or check out the manual setup guide.`,\n );\n clack.log.info(`Setup React Router manually: ${chalk.cyan(docsUrl)}`);\n clack.outro('WorkOS AuthKit installer will see you next time!');\n return '';\n }\n }\n\n const { runAgentInstaller } = await import('../../lib/agent-runner.js');\n return runAgentInstaller(config, options);\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import type { InstallerOptions } from '../../utils/types.js';
2
+ export declare enum ReactRouterMode {
3
+ V6 = "v6",
4
+ V7_FRAMEWORK = "v7-framework",
5
+ V7_DATA = "v7-data",
6
+ V7_DECLARATIVE = "v7-declarative"
7
+ }
8
+ export declare function getReactRouterVersionBucket(version: string | undefined): string;
9
+ export declare function getReactRouterMode(options: InstallerOptions): Promise<ReactRouterMode>;
10
+ export declare function getReactRouterModeName(mode: ReactRouterMode): string;