workos 0.3.3 → 0.5.0
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.
- package/dist/bin.js +57 -9
- package/dist/bin.js.map +1 -1
- package/dist/commands/doctor.d.ts +10 -0
- package/dist/commands/doctor.js +30 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/login.js +21 -1
- package/dist/commands/login.js.map +1 -1
- package/dist/doctor/checks/connectivity.d.ts +2 -0
- package/dist/doctor/checks/connectivity.js +35 -0
- package/dist/doctor/checks/connectivity.js.map +1 -0
- package/dist/doctor/checks/dashboard.d.ts +3 -0
- package/dist/doctor/checks/dashboard.js +123 -0
- package/dist/doctor/checks/dashboard.js.map +1 -0
- package/dist/doctor/checks/environment.d.ts +2 -0
- package/dist/doctor/checks/environment.js +68 -0
- package/dist/doctor/checks/environment.js.map +1 -0
- package/dist/doctor/checks/framework.d.ts +2 -0
- package/dist/doctor/checks/framework.js +75 -0
- package/dist/doctor/checks/framework.js.map +1 -0
- package/dist/doctor/checks/runtime.d.ts +2 -0
- package/dist/doctor/checks/runtime.js +20 -0
- package/dist/doctor/checks/runtime.js.map +1 -0
- package/dist/doctor/checks/sdk.d.ts +2 -0
- package/dist/doctor/checks/sdk.js +111 -0
- package/dist/doctor/checks/sdk.js.map +1 -0
- package/dist/doctor/clipboard.d.ts +1 -0
- package/dist/doctor/clipboard.js +43 -0
- package/dist/doctor/clipboard.js.map +1 -0
- package/dist/doctor/index.d.ts +6 -0
- package/dist/doctor/index.js +94 -0
- package/dist/doctor/index.js.map +1 -0
- package/dist/doctor/issues.d.ts +58 -0
- package/dist/doctor/issues.js +134 -0
- package/dist/doctor/issues.js.map +1 -0
- package/dist/doctor/json-output.d.ts +2 -0
- package/dist/doctor/json-output.js +4 -0
- package/dist/doctor/json-output.js.map +1 -0
- package/dist/doctor/output.d.ts +5 -0
- package/dist/doctor/output.js +149 -0
- package/dist/doctor/output.js.map +1 -0
- package/dist/doctor/types.d.ts +105 -0
- package/dist/doctor/types.js +2 -0
- package/dist/doctor/types.js.map +1 -0
- package/dist/integrations/dotnet/index.d.ts +8 -0
- package/dist/integrations/dotnet/index.js +163 -0
- package/dist/integrations/dotnet/index.js.map +1 -0
- package/dist/integrations/elixir/index.d.ts +8 -0
- package/dist/integrations/elixir/index.js +152 -0
- package/dist/integrations/elixir/index.js.map +1 -0
- package/dist/integrations/go/index.d.ts +11 -0
- package/dist/integrations/go/index.js +220 -0
- package/dist/integrations/go/index.js.map +1 -0
- package/dist/integrations/kotlin/index.d.ts +4 -0
- package/dist/integrations/kotlin/index.js +53 -0
- package/dist/integrations/kotlin/index.js.map +1 -0
- package/dist/integrations/nextjs/index.d.ts +4 -0
- package/dist/integrations/nextjs/index.js +90 -0
- package/dist/integrations/nextjs/index.js.map +1 -0
- package/dist/integrations/nextjs/utils.d.ts +8 -0
- package/dist/integrations/nextjs/utils.js +53 -0
- package/dist/integrations/nextjs/utils.js.map +1 -0
- package/dist/integrations/node/index.d.ts +4 -0
- package/dist/integrations/node/index.js +52 -0
- package/dist/integrations/node/index.js.map +1 -0
- package/dist/integrations/php/index.d.ts +4 -0
- package/dist/integrations/php/index.js +51 -0
- package/dist/integrations/php/index.js.map +1 -0
- package/dist/integrations/php-laravel/index.d.ts +4 -0
- package/dist/integrations/php-laravel/index.js +51 -0
- package/dist/integrations/php-laravel/index.js.map +1 -0
- package/dist/integrations/python/index.d.ts +9 -0
- package/dist/integrations/python/index.js +254 -0
- package/dist/integrations/python/index.js.map +1 -0
- package/dist/integrations/react/index.d.ts +4 -0
- package/dist/integrations/react/index.js +49 -0
- package/dist/integrations/react/index.js.map +1 -0
- package/dist/integrations/react-router/index.d.ts +4 -0
- package/dist/integrations/react-router/index.js +94 -0
- package/dist/integrations/react-router/index.js.map +1 -0
- package/dist/integrations/react-router/utils.d.ts +10 -0
- package/dist/integrations/react-router/utils.js +146 -0
- package/dist/integrations/react-router/utils.js.map +1 -0
- package/dist/integrations/ruby/index.d.ts +8 -0
- package/dist/integrations/ruby/index.js +142 -0
- package/dist/integrations/ruby/index.js.map +1 -0
- package/dist/integrations/sveltekit/index.d.ts +4 -0
- package/dist/integrations/sveltekit/index.js +50 -0
- package/dist/integrations/sveltekit/index.js.map +1 -0
- package/dist/integrations/tanstack-start/index.d.ts +4 -0
- package/dist/integrations/tanstack-start/index.js +51 -0
- package/dist/integrations/tanstack-start/index.js.map +1 -0
- package/dist/integrations/vanilla-js/index.d.ts +4 -0
- package/dist/integrations/vanilla-js/index.js +49 -0
- package/dist/integrations/vanilla-js/index.js.map +1 -0
- package/dist/lib/agent-interface.js +66 -1
- package/dist/lib/agent-interface.js.map +1 -1
- package/dist/lib/config.d.ts +32 -58
- package/dist/lib/config.js +19 -70
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/constants.d.ts +17 -14
- package/dist/lib/constants.js +12 -31
- package/dist/lib/constants.js.map +1 -1
- package/dist/lib/credential-store.d.ts +28 -0
- package/dist/lib/credential-store.js +150 -0
- package/dist/lib/credential-store.js.map +1 -0
- package/dist/lib/credentials.d.ts +3 -37
- package/dist/lib/credentials.js +2 -85
- package/dist/lib/credentials.js.map +1 -1
- package/dist/lib/framework-config.d.ts +13 -4
- package/dist/lib/framework-config.js.map +1 -1
- package/dist/lib/language-detection.d.ts +20 -0
- package/dist/lib/language-detection.js +96 -0
- package/dist/lib/language-detection.js.map +1 -0
- package/dist/lib/port-detection.js +4 -2
- package/dist/lib/port-detection.js.map +1 -1
- package/dist/lib/registry.d.ts +43 -0
- package/dist/lib/registry.js +96 -0
- package/dist/lib/registry.js.map +1 -0
- package/dist/lib/run-with-core.js +70 -26
- package/dist/lib/run-with-core.js.map +1 -1
- package/dist/nextjs/nextjs-installer-agent.d.ts +3 -4
- package/dist/nextjs/nextjs-installer-agent.js +3 -94
- package/dist/nextjs/nextjs-installer-agent.js.map +1 -1
- package/dist/nextjs/utils.d.ts +4 -8
- package/dist/nextjs/utils.js +4 -52
- package/dist/nextjs/utils.js.map +1 -1
- package/dist/react/react-installer-agent.d.ts +4 -2
- package/dist/react/react-installer-agent.js +4 -46
- package/dist/react/react-installer-agent.js.map +1 -1
- package/dist/react-router/react-router-installer-agent.d.ts +2 -4
- package/dist/react-router/react-router-installer-agent.js +2 -100
- package/dist/react-router/react-router-installer-agent.js.map +1 -1
- package/dist/react-router/utils.d.ts +2 -17
- package/dist/react-router/utils.js +2 -207
- package/dist/react-router/utils.js.map +1 -1
- package/dist/tanstack-start/tanstack-start-installer-agent.d.ts +4 -2
- package/dist/tanstack-start/tanstack-start-installer-agent.js +4 -48
- package/dist/tanstack-start/tanstack-start-installer-agent.js.map +1 -1
- package/dist/vanilla-js/vanilla-js-installer-agent.d.ts +4 -2
- package/dist/vanilla-js/vanilla-js-installer-agent.js +4 -46
- package/dist/vanilla-js/vanilla-js-installer-agent.js.map +1 -1
- package/package.json +9 -6
- package/skills/workos-authkit-sveltekit/SKILL.md +160 -0
- package/skills/workos-dotnet/SKILL.md +163 -0
- package/skills/workos-elixir/SKILL.md +194 -0
- package/skills/workos-go/SKILL.md +191 -0
- package/skills/workos-kotlin/SKILL.md +161 -0
- package/skills/workos-node/SKILL.md +164 -0
- package/skills/workos-php/SKILL.md +127 -0
- package/skills/workos-php-laravel/SKILL.md +147 -0
- package/skills/workos-python/SKILL.md +159 -0
- package/skills/workos-ruby/SKILL.md +163 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { enableDebugLogs } from '../../utils/debug.js';
|
|
2
|
+
import { SPINNER_MESSAGE } from '../../lib/framework-config.js';
|
|
3
|
+
import { analytics } from '../../utils/analytics.js';
|
|
4
|
+
import { INSTALLER_INTERACTION_EVENT_NAME } from '../../lib/constants.js';
|
|
5
|
+
import { getOrAskForWorkOSCredentials } from '../../utils/clack-utils.js';
|
|
6
|
+
import { initializeAgent, runAgent } from '../../lib/agent-interface.js';
|
|
7
|
+
import { writeEnvLocal } from '../../lib/env-writer.js';
|
|
8
|
+
export const config = {
|
|
9
|
+
metadata: {
|
|
10
|
+
name: 'Elixir (Phoenix)',
|
|
11
|
+
integration: 'elixir',
|
|
12
|
+
docsUrl: 'https://github.com/workos/workos-elixir',
|
|
13
|
+
skillName: 'workos-elixir',
|
|
14
|
+
language: 'elixir',
|
|
15
|
+
stability: 'experimental',
|
|
16
|
+
priority: 30,
|
|
17
|
+
packageManager: 'mix',
|
|
18
|
+
manifestFile: 'mix.exs',
|
|
19
|
+
},
|
|
20
|
+
detection: {
|
|
21
|
+
// Required by FrameworkDetection interface — stubs for non-JS integration.
|
|
22
|
+
// Actual detection uses language-detection.ts (mix.exs) + registry manifestFile check.
|
|
23
|
+
packageName: 'workos',
|
|
24
|
+
packageDisplayName: 'WorkOS Elixir',
|
|
25
|
+
getVersion: () => undefined,
|
|
26
|
+
},
|
|
27
|
+
environment: {
|
|
28
|
+
uploadToHosting: false,
|
|
29
|
+
requiresApiKey: true,
|
|
30
|
+
getEnvVars: (apiKey, clientId) => ({
|
|
31
|
+
WORKOS_API_KEY: apiKey,
|
|
32
|
+
WORKOS_CLIENT_ID: clientId,
|
|
33
|
+
}),
|
|
34
|
+
},
|
|
35
|
+
analytics: {
|
|
36
|
+
getTags: () => ({}),
|
|
37
|
+
},
|
|
38
|
+
prompts: {},
|
|
39
|
+
ui: {
|
|
40
|
+
successMessage: 'WorkOS AuthKit integration complete',
|
|
41
|
+
getOutroChanges: () => [
|
|
42
|
+
'Analyzed your Phoenix project structure',
|
|
43
|
+
'Installed workos Hex package',
|
|
44
|
+
'Configured WorkOS in config/runtime.exs',
|
|
45
|
+
'Created auth controller and routes',
|
|
46
|
+
],
|
|
47
|
+
getOutroNextSteps: () => [
|
|
48
|
+
'Run `mix phx.server` to test authentication',
|
|
49
|
+
'Visit the WorkOS Dashboard to manage users and settings',
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Custom run function for Elixir — bypasses runAgentInstaller() which assumes
|
|
55
|
+
* package.json exists. Directly calls initializeAgent/runAgent instead.
|
|
56
|
+
*/
|
|
57
|
+
export async function run(options) {
|
|
58
|
+
if (options.debug) {
|
|
59
|
+
enableDebugLogs();
|
|
60
|
+
}
|
|
61
|
+
options.emitter?.emit('status', {
|
|
62
|
+
message: `Setting up WorkOS AuthKit for ${config.metadata.name}`,
|
|
63
|
+
});
|
|
64
|
+
analytics.capture(INSTALLER_INTERACTION_EVENT_NAME, {
|
|
65
|
+
action: 'started agent integration',
|
|
66
|
+
integration: config.metadata.integration,
|
|
67
|
+
});
|
|
68
|
+
// Get WorkOS credentials
|
|
69
|
+
const { apiKey, clientId } = await getOrAskForWorkOSCredentials(options, config.environment.requiresApiKey);
|
|
70
|
+
// Write env vars to .env.local for the agent to reference
|
|
71
|
+
const callerHandledConfig = Boolean(options.apiKey || options.clientId);
|
|
72
|
+
if (!callerHandledConfig) {
|
|
73
|
+
const port = 4000; // Phoenix default
|
|
74
|
+
const callbackPath = '/auth/callback';
|
|
75
|
+
const redirectUri = options.redirectUri || `http://localhost:${port}${callbackPath}`;
|
|
76
|
+
writeEnvLocal(options.installDir, {
|
|
77
|
+
...(apiKey ? { WORKOS_API_KEY: apiKey } : {}),
|
|
78
|
+
WORKOS_CLIENT_ID: clientId,
|
|
79
|
+
WORKOS_REDIRECT_URI: redirectUri,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
// Build Elixir-specific prompt
|
|
83
|
+
const integrationPrompt = buildElixirPrompt();
|
|
84
|
+
// Initialize and run agent
|
|
85
|
+
const agent = await initializeAgent({
|
|
86
|
+
workingDirectory: options.installDir,
|
|
87
|
+
workOSApiKey: apiKey,
|
|
88
|
+
workOSApiHost: 'https://api.workos.com',
|
|
89
|
+
}, options);
|
|
90
|
+
const agentResult = await runAgent(agent, integrationPrompt, options, {
|
|
91
|
+
spinnerMessage: SPINNER_MESSAGE,
|
|
92
|
+
successMessage: config.ui.successMessage,
|
|
93
|
+
errorMessage: 'Integration failed',
|
|
94
|
+
}, options.emitter);
|
|
95
|
+
if (agentResult.error) {
|
|
96
|
+
await analytics.shutdown('error');
|
|
97
|
+
const message = agentResult.errorMessage || agentResult.error;
|
|
98
|
+
throw new Error(`Agent SDK error: ${message}`);
|
|
99
|
+
}
|
|
100
|
+
// Build summary
|
|
101
|
+
const changes = config.ui.getOutroChanges({});
|
|
102
|
+
const nextSteps = config.ui.getOutroNextSteps({});
|
|
103
|
+
const lines = [
|
|
104
|
+
'Successfully installed WorkOS AuthKit!',
|
|
105
|
+
'',
|
|
106
|
+
'What the agent did:',
|
|
107
|
+
...changes.map((c) => `• ${c}`),
|
|
108
|
+
'',
|
|
109
|
+
'Next steps:',
|
|
110
|
+
...nextSteps.map((s) => `• ${s}`),
|
|
111
|
+
'',
|
|
112
|
+
`Learn more: ${config.metadata.docsUrl}`,
|
|
113
|
+
'',
|
|
114
|
+
'Note: This installer uses an LLM agent to analyze and modify your project. Please review the changes made.',
|
|
115
|
+
];
|
|
116
|
+
await analytics.shutdown('success');
|
|
117
|
+
return lines.join('\n');
|
|
118
|
+
}
|
|
119
|
+
function buildElixirPrompt() {
|
|
120
|
+
return `You are integrating WorkOS AuthKit into this Elixir/Phoenix application.
|
|
121
|
+
|
|
122
|
+
## Project Context
|
|
123
|
+
|
|
124
|
+
- Framework: Phoenix (Elixir)
|
|
125
|
+
- Package manager: mix (Hex)
|
|
126
|
+
|
|
127
|
+
## Environment
|
|
128
|
+
|
|
129
|
+
The following environment variables have been configured in .env.local:
|
|
130
|
+
- WORKOS_API_KEY
|
|
131
|
+
- WORKOS_CLIENT_ID
|
|
132
|
+
- WORKOS_REDIRECT_URI
|
|
133
|
+
|
|
134
|
+
Note: For Elixir/Phoenix, these should be read via System.get_env() in config/runtime.exs rather than from .env.local directly.
|
|
135
|
+
|
|
136
|
+
## Your Task
|
|
137
|
+
|
|
138
|
+
Use the \`workos-elixir\` skill to integrate WorkOS AuthKit into this application.
|
|
139
|
+
|
|
140
|
+
The skill contains step-by-step instructions including:
|
|
141
|
+
1. Fetching the SDK documentation
|
|
142
|
+
2. Validating the Phoenix project structure
|
|
143
|
+
3. Installing the workos Hex package
|
|
144
|
+
4. Configuring WorkOS in runtime.exs
|
|
145
|
+
5. Creating auth controller and routes
|
|
146
|
+
6. Verification with mix compile
|
|
147
|
+
|
|
148
|
+
Report your progress using [STATUS] prefixes.
|
|
149
|
+
|
|
150
|
+
Begin by invoking the workos-elixir skill.`;
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/integrations/elixir/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,CAAC,MAAM,MAAM,GAAoB;IACrC,QAAQ,EAAE;QACR,IAAI,EAAE,kBAAkB;QACxB,WAAW,EAAE,QAAQ;QACrB,OAAO,EAAE,yCAAyC;QAClD,SAAS,EAAE,eAAe;QAC1B,QAAQ,EAAE,QAAQ;QAClB,SAAS,EAAE,cAAc;QACzB,QAAQ,EAAE,EAAE;QACZ,cAAc,EAAE,KAAK;QACrB,YAAY,EAAE,SAAS;KACxB;IAED,SAAS,EAAE;QACT,2EAA2E;QAC3E,uFAAuF;QACvF,WAAW,EAAE,QAAQ;QACrB,kBAAkB,EAAE,eAAe;QACnC,UAAU,EAAE,GAAG,EAAE,CAAC,SAAS;KAC5B;IAED,WAAW,EAAE;QACX,eAA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iB,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;AAED,SAAS,iBAAiB;IACxB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CA8BkC,CAAC;AAC5C,CAAC","sourcesContent":["/* Elixir/Phoenix 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 { SPINNER_MESSAGE } from '../../lib/framework-config.js';\nimport { analytics } from '../../utils/analytics.js';\nimport { INSTALLER_INTERACTION_EVENT_NAME } from '../../lib/constants.js';\nimport { getOrAskForWorkOSCredentials } from '../../utils/clack-utils.js';\nimport { initializeAgent, runAgent } from '../../lib/agent-interface.js';\nimport { writeEnvLocal } from '../../lib/env-writer.js';\n\nexport const config: FrameworkConfig = {\n metadata: {\n name: 'Elixir (Phoenix)',\n integration: 'elixir',\n docsUrl: 'https://github.com/workos/workos-elixir',\n skillName: 'workos-elixir',\n language: 'elixir',\n stability: 'experimental',\n priority: 30,\n packageManager: 'mix',\n manifestFile: 'mix.exs',\n },\n\n detection: {\n // Required by FrameworkDetection interface — stubs for non-JS integration.\n // Actual detection uses language-detection.ts (mix.exs) + registry manifestFile check.\n packageName: 'workos',\n packageDisplayName: 'WorkOS Elixir',\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 Phoenix project structure',\n 'Installed workos Hex package',\n 'Configured WorkOS in config/runtime.exs',\n 'Created auth controller and routes',\n ],\n getOutroNextSteps: () => [\n 'Run `mix phx.server` to test authentication',\n 'Visit the WorkOS Dashboard to manage users and settings',\n ],\n },\n};\n\n/**\n * Custom run function for Elixir — bypasses runAgentInstaller() which assumes\n * package.json exists. Directly calls initializeAgent/runAgent instead.\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 // Write env vars to .env.local for the agent to reference\n const callerHandledConfig = Boolean(options.apiKey || options.clientId);\n if (!callerHandledConfig) {\n const port = 4000; // Phoenix default\n const callbackPath = '/auth/callback';\n const redirectUri = options.redirectUri || `http://localhost:${port}${callbackPath}`;\n\n writeEnvLocal(options.installDir, {\n ...(apiKey ? { WORKOS_API_KEY: apiKey } : {}),\n WORKOS_CLIENT_ID: clientId,\n WORKOS_REDIRECT_URI: redirectUri,\n });\n }\n\n // Build Elixir-specific prompt\n const integrationPrompt = buildElixirPrompt();\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 // Build 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\nfunction buildElixirPrompt(): string {\n return `You are integrating WorkOS AuthKit into this Elixir/Phoenix application.\n\n## Project Context\n\n- Framework: Phoenix (Elixir)\n- Package manager: mix (Hex)\n\n## Environment\n\nThe following environment variables have been configured in .env.local:\n- WORKOS_API_KEY\n- WORKOS_CLIENT_ID\n- WORKOS_REDIRECT_URI\n\nNote: For Elixir/Phoenix, these should be read via System.get_env() in config/runtime.exs rather than from .env.local directly.\n\n## Your Task\n\nUse the \\`workos-elixir\\` skill to integrate WorkOS AuthKit into this application.\n\nThe skill contains step-by-step instructions including:\n1. Fetching the SDK documentation\n2. Validating the Phoenix project structure\n3. Installing the workos Hex package\n4. Configuring WorkOS in runtime.exs\n5. Creating auth controller and routes\n6. Verification with mix compile\n\nReport your progress using [STATUS] prefixes.\n\nBegin by invoking the workos-elixir skill.`;\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
* Run the Go integration.
|
|
6
|
+
*
|
|
7
|
+
* Custom flow that bypasses runAgentInstaller because the universal runner
|
|
8
|
+
* assumes package.json exists (getPackageDotJson aborts without it) and
|
|
9
|
+
* port-detection/env-writer are JS-specific.
|
|
10
|
+
*/
|
|
11
|
+
export declare function run(options: InstallerOptions): Promise<string>;
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/* Go integration — auto-discovered by registry */
|
|
2
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { SPINNER_MESSAGE } from '../../lib/framework-config.js';
|
|
5
|
+
import { enableDebugLogs } from '../../utils/debug.js';
|
|
6
|
+
import { analytics } from '../../utils/analytics.js';
|
|
7
|
+
import { INSTALLER_INTERACTION_EVENT_NAME } from '../../lib/constants.js';
|
|
8
|
+
import { initializeAgent, runAgent } from '../../lib/agent-interface.js';
|
|
9
|
+
import { getOrAskForWorkOSCredentials } from '../../utils/clack-utils.js';
|
|
10
|
+
import { autoConfigureWorkOSEnvironment } from '../../lib/workos-management.js';
|
|
11
|
+
import { validateInstallation } from '../../lib/validation/index.js';
|
|
12
|
+
import { parseEnvFile } from '../../utils/env-parser.js';
|
|
13
|
+
/** Default port for Go HTTP servers */
|
|
14
|
+
const GO_DEFAULT_PORT = 8080;
|
|
15
|
+
const GO_CALLBACK_PATH = '/auth/callback';
|
|
16
|
+
/**
|
|
17
|
+
* Detect whether go.mod includes the Gin web framework.
|
|
18
|
+
*/
|
|
19
|
+
function detectGoFramework(installDir) {
|
|
20
|
+
try {
|
|
21
|
+
const goMod = readFileSync(join(installDir, 'go.mod'), 'utf-8');
|
|
22
|
+
return goMod.includes('github.com/gin-gonic/gin') ? 'gin' : 'stdlib';
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return 'stdlib';
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Write environment variables to .env (Go convention, not .env.local).
|
|
30
|
+
* Merges with existing .env if present.
|
|
31
|
+
*/
|
|
32
|
+
function writeGoEnv(installDir, envVars) {
|
|
33
|
+
const envPath = join(installDir, '.env');
|
|
34
|
+
let existing = {};
|
|
35
|
+
if (existsSync(envPath)) {
|
|
36
|
+
existing = parseEnvFile(readFileSync(envPath, 'utf-8'));
|
|
37
|
+
}
|
|
38
|
+
const merged = { ...existing, ...envVars };
|
|
39
|
+
const content = Object.entries(merged)
|
|
40
|
+
.map(([key, value]) => `${key}=${value}`)
|
|
41
|
+
.join('\n');
|
|
42
|
+
writeFileSync(envPath, content + '\n');
|
|
43
|
+
}
|
|
44
|
+
export const config = {
|
|
45
|
+
metadata: {
|
|
46
|
+
name: 'Go',
|
|
47
|
+
integration: 'go',
|
|
48
|
+
docsUrl: 'https://workos.com/docs/authkit/vanilla/go',
|
|
49
|
+
skillName: 'workos-go',
|
|
50
|
+
language: 'go',
|
|
51
|
+
stability: 'experimental',
|
|
52
|
+
priority: 50,
|
|
53
|
+
packageManager: 'go',
|
|
54
|
+
manifestFile: 'go.mod',
|
|
55
|
+
gatherContext: async (options) => {
|
|
56
|
+
return { framework: detectGoFramework(options.installDir) };
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
detection: {
|
|
60
|
+
packageName: 'github.com/workos/workos-go/v4',
|
|
61
|
+
packageDisplayName: 'Go',
|
|
62
|
+
getVersion: () => undefined,
|
|
63
|
+
},
|
|
64
|
+
environment: {
|
|
65
|
+
uploadToHosting: false,
|
|
66
|
+
requiresApiKey: true,
|
|
67
|
+
getEnvVars: (apiKey, clientId) => ({
|
|
68
|
+
WORKOS_API_KEY: apiKey,
|
|
69
|
+
WORKOS_CLIENT_ID: clientId,
|
|
70
|
+
}),
|
|
71
|
+
},
|
|
72
|
+
analytics: {
|
|
73
|
+
getTags: (context) => (context?.framework ? { 'go-framework': context.framework } : {}),
|
|
74
|
+
},
|
|
75
|
+
prompts: {
|
|
76
|
+
getAdditionalContextLines: (context) => [
|
|
77
|
+
...(context?.framework ? [`Go web framework: ${context.framework}`] : []),
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
ui: {
|
|
81
|
+
successMessage: 'WorkOS AuthKit integration complete',
|
|
82
|
+
getOutroChanges: () => [
|
|
83
|
+
'Analyzed your Go project structure',
|
|
84
|
+
'Installed workos-go SDK',
|
|
85
|
+
'Created authentication handlers',
|
|
86
|
+
'Configured environment variables',
|
|
87
|
+
],
|
|
88
|
+
getOutroNextSteps: () => [
|
|
89
|
+
'Run `go run .` to start your server',
|
|
90
|
+
'Visit the WorkOS Dashboard to manage users and settings',
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Run the Go integration.
|
|
96
|
+
*
|
|
97
|
+
* Custom flow that bypasses runAgentInstaller because the universal runner
|
|
98
|
+
* assumes package.json exists (getPackageDotJson aborts without it) and
|
|
99
|
+
* port-detection/env-writer are JS-specific.
|
|
100
|
+
*/
|
|
101
|
+
export async function run(options) {
|
|
102
|
+
if (options.debug) {
|
|
103
|
+
enableDebugLogs();
|
|
104
|
+
}
|
|
105
|
+
options.emitter?.emit('status', {
|
|
106
|
+
message: `Setting up WorkOS AuthKit for ${config.metadata.name}`,
|
|
107
|
+
});
|
|
108
|
+
analytics.capture(INSTALLER_INTERACTION_EVENT_NAME, {
|
|
109
|
+
action: 'started agent integration',
|
|
110
|
+
integration: config.metadata.integration,
|
|
111
|
+
});
|
|
112
|
+
// Get WorkOS credentials
|
|
113
|
+
const { apiKey, clientId } = await getOrAskForWorkOSCredentials(options, config.environment.requiresApiKey);
|
|
114
|
+
// Auto-configure WorkOS environment (redirect URI, CORS)
|
|
115
|
+
const callerHandledConfig = Boolean(options.apiKey || options.clientId);
|
|
116
|
+
if (!callerHandledConfig && apiKey) {
|
|
117
|
+
const redirectUri = options.redirectUri || `http://localhost:${GO_DEFAULT_PORT}${GO_CALLBACK_PATH}`;
|
|
118
|
+
await autoConfigureWorkOSEnvironment(apiKey, config.metadata.integration, GO_DEFAULT_PORT, {
|
|
119
|
+
homepageUrl: options.homepageUrl,
|
|
120
|
+
redirectUri,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
// Gather Go-specific context
|
|
124
|
+
const frameworkContext = config.metadata.gatherContext ? await config.metadata.gatherContext(options) : {};
|
|
125
|
+
// Write .env (not .env.local — Go convention)
|
|
126
|
+
if (!callerHandledConfig) {
|
|
127
|
+
const redirectUri = options.redirectUri || `http://localhost:${GO_DEFAULT_PORT}${GO_CALLBACK_PATH}`;
|
|
128
|
+
writeGoEnv(options.installDir, {
|
|
129
|
+
...(apiKey ? { WORKOS_API_KEY: apiKey } : {}),
|
|
130
|
+
WORKOS_CLIENT_ID: clientId,
|
|
131
|
+
WORKOS_REDIRECT_URI: redirectUri,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
// Set analytics tags
|
|
135
|
+
const contextTags = config.analytics.getTags(frameworkContext);
|
|
136
|
+
Object.entries(contextTags).forEach(([key, value]) => {
|
|
137
|
+
analytics.setTag(key, value);
|
|
138
|
+
});
|
|
139
|
+
// Build prompt
|
|
140
|
+
const additionalLines = config.prompts.getAdditionalContextLines
|
|
141
|
+
? config.prompts.getAdditionalContextLines(frameworkContext)
|
|
142
|
+
: [];
|
|
143
|
+
const additionalContext = additionalLines.length > 0 ? '\n' + additionalLines.map((line) => `- ${line}`).join('\n') : '';
|
|
144
|
+
const skillName = config.metadata.skillName;
|
|
145
|
+
const integrationPrompt = `You are integrating WorkOS AuthKit into this ${config.metadata.name} application.
|
|
146
|
+
|
|
147
|
+
## Project Context
|
|
148
|
+
|
|
149
|
+
- Language: Go
|
|
150
|
+
- Framework: ${frameworkContext.framework === 'gin' ? 'Gin' : 'stdlib net/http'}${additionalContext}
|
|
151
|
+
|
|
152
|
+
## Environment
|
|
153
|
+
|
|
154
|
+
The following environment variables have been configured in .env:
|
|
155
|
+
- WORKOS_API_KEY
|
|
156
|
+
- WORKOS_CLIENT_ID
|
|
157
|
+
- WORKOS_REDIRECT_URI
|
|
158
|
+
|
|
159
|
+
## Your Task
|
|
160
|
+
|
|
161
|
+
Use the \`${skillName}\` skill to integrate WorkOS AuthKit into this application.
|
|
162
|
+
|
|
163
|
+
The skill contains step-by-step instructions including:
|
|
164
|
+
1. Fetching the SDK documentation
|
|
165
|
+
2. Installing the SDK
|
|
166
|
+
3. Detecting Gin vs stdlib
|
|
167
|
+
4. Creating authentication handlers
|
|
168
|
+
5. Wiring handlers into the router
|
|
169
|
+
6. Verification with go build and go vet
|
|
170
|
+
|
|
171
|
+
Report your progress using [STATUS] prefixes.
|
|
172
|
+
|
|
173
|
+
Begin by invoking the ${skillName} skill.`;
|
|
174
|
+
// Initialize and run agent
|
|
175
|
+
const agent = await initializeAgent({
|
|
176
|
+
workingDirectory: options.installDir,
|
|
177
|
+
workOSApiKey: apiKey,
|
|
178
|
+
workOSApiHost: 'https://api.workos.com',
|
|
179
|
+
}, options);
|
|
180
|
+
const agentResult = await runAgent(agent, integrationPrompt, options, {
|
|
181
|
+
spinnerMessage: SPINNER_MESSAGE,
|
|
182
|
+
successMessage: config.ui.successMessage,
|
|
183
|
+
errorMessage: 'Integration failed',
|
|
184
|
+
}, options.emitter);
|
|
185
|
+
if (agentResult.error) {
|
|
186
|
+
await analytics.shutdown('error');
|
|
187
|
+
const message = agentResult.errorMessage || agentResult.error;
|
|
188
|
+
throw new Error(`Agent SDK error: ${message}`);
|
|
189
|
+
}
|
|
190
|
+
// Post-installation validation (gracefully skips — no rules file for Go)
|
|
191
|
+
if (!options.noValidate) {
|
|
192
|
+
options.emitter?.emit('validation:start', { framework: config.metadata.integration });
|
|
193
|
+
const validationResult = await validateInstallation(config.metadata.integration, options.installDir, {
|
|
194
|
+
runBuild: true,
|
|
195
|
+
});
|
|
196
|
+
if (validationResult.issues.length > 0) {
|
|
197
|
+
options.emitter?.emit('validation:issues', { issues: validationResult.issues });
|
|
198
|
+
}
|
|
199
|
+
options.emitter?.emit('validation:complete', {
|
|
200
|
+
passed: validationResult.passed,
|
|
201
|
+
issueCount: validationResult.issues.length,
|
|
202
|
+
durationMs: validationResult.durationMs,
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
// Build summary
|
|
206
|
+
const changes = config.ui.getOutroChanges(frameworkContext).filter(Boolean);
|
|
207
|
+
const nextSteps = config.ui.getOutroNextSteps(frameworkContext).filter(Boolean);
|
|
208
|
+
const lines = [
|
|
209
|
+
'Successfully installed WorkOS AuthKit!',
|
|
210
|
+
'',
|
|
211
|
+
...(changes.length > 0 ? ['What the agent did:', ...changes.map((c) => `• ${c}`), ''] : []),
|
|
212
|
+
...(nextSteps.length > 0 ? ['Next steps:', ...nextSteps.map((s) => `• ${s}`), ''] : []),
|
|
213
|
+
`Learn more: ${config.metadata.docsUrl}`,
|
|
214
|
+
'',
|
|
215
|
+
'Note: This installer uses an LLM agent to analyze and modify your project. Please review the changes made.',
|
|
216
|
+
];
|
|
217
|
+
await analytics.shutdown('success');
|
|
218
|
+
return lines.join('\n');
|
|
219
|
+
}
|
|
220
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACzE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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"]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { enableDebugLogs } from '../../utils/debug.js';
|
|
2
|
+
export const config = {
|
|
3
|
+
metadata: {
|
|
4
|
+
name: 'Kotlin (Spring Boot)',
|
|
5
|
+
integration: 'kotlin',
|
|
6
|
+
docsUrl: 'https://github.com/workos/workos-kotlin',
|
|
7
|
+
skillName: 'workos-kotlin',
|
|
8
|
+
language: 'kotlin',
|
|
9
|
+
stability: 'experimental',
|
|
10
|
+
priority: 40,
|
|
11
|
+
packageManager: 'gradle',
|
|
12
|
+
manifestFile: 'build.gradle.kts',
|
|
13
|
+
},
|
|
14
|
+
detection: {
|
|
15
|
+
packageName: 'com.workos:workos-kotlin',
|
|
16
|
+
packageDisplayName: 'Kotlin (Spring Boot)',
|
|
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 Kotlin/Spring Boot project structure',
|
|
35
|
+
'Added WorkOS Kotlin SDK dependency to build.gradle.kts',
|
|
36
|
+
'Created authentication controller with login, callback, and logout endpoints',
|
|
37
|
+
'Configured application.properties with WorkOS credentials',
|
|
38
|
+
],
|
|
39
|
+
getOutroNextSteps: () => [
|
|
40
|
+
'Run ./gradlew bootRun to start your application',
|
|
41
|
+
'Visit http://localhost:8080/auth/login to test authentication',
|
|
42
|
+
'Visit the WorkOS Dashboard to manage users and settings',
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
export async function run(options) {
|
|
47
|
+
if (options.debug) {
|
|
48
|
+
enableDebugLogs();
|
|
49
|
+
}
|
|
50
|
+
const { runAgentInstaller } = await import('../../lib/agent-runner.js');
|
|
51
|
+
return runAgentInstaller(config, options);
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceR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AM,MAAM,CAAC,2BAA2B,CAAC,CAAC;IACxE,OAAO,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["/* Kotlin (Spring Boot) 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: 'Kotlin (Spring Boot)',\n integration: 'kotlin',\n docsUrl: 'https://github.com/workos/workos-kotlin',\n skillName: 'workos-kotlin',\n language: 'kotlin',\n stability: 'experimental',\n priority: 40,\n packageManager: 'gradle',\n manifestFile: 'build.gradle.kts',\n },\n\n detection: {\n packageName: 'com.workos:workos-kotlin',\n packageDisplayName: 'Kotlin (Spring Boot)',\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 Kotlin/Spring Boot project structure',\n 'Added WorkOS Kotlin SDK dependency to build.gradle.kts',\n 'Created authentication controller with login, callback, and logout endpoints',\n 'Configured application.properties with WorkOS credentials',\n ],\n getOutroNextSteps: () => [\n 'Run ./gradlew bootRun to start your application',\n 'Visit http://localhost:8080/auth/login 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,90 @@
|
|
|
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 { getNextJsRouter, getNextJsVersionBucket, getNextJsRouterName, NextJsRouter } from './utils.js';
|
|
8
|
+
const MINIMUM_NEXTJS_VERSION = '15.3.0';
|
|
9
|
+
export const config = {
|
|
10
|
+
metadata: {
|
|
11
|
+
name: 'Next.js',
|
|
12
|
+
integration: 'nextjs',
|
|
13
|
+
docsUrl: 'https://workos.com/docs/user-management/authkit/nextjs',
|
|
14
|
+
unsupportedVersionDocsUrl: 'https://workos.com/docs/user-management/authkit/nextjs',
|
|
15
|
+
skillName: 'workos-authkit-nextjs',
|
|
16
|
+
language: 'javascript',
|
|
17
|
+
stability: 'stable',
|
|
18
|
+
priority: 100,
|
|
19
|
+
gatherContext: async (options) => {
|
|
20
|
+
const router = await getNextJsRouter(options);
|
|
21
|
+
return { router };
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
detection: {
|
|
25
|
+
packageName: 'next',
|
|
26
|
+
packageDisplayName: 'Next.js',
|
|
27
|
+
getVersion: (packageJson) => getPackageVersion('next', packageJson),
|
|
28
|
+
getVersionBucket: getNextJsVersionBucket,
|
|
29
|
+
},
|
|
30
|
+
environment: {
|
|
31
|
+
uploadToHosting: true,
|
|
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 router = context.router;
|
|
41
|
+
return {
|
|
42
|
+
router: router === NextJsRouter.APP_ROUTER ? 'app' : 'pages',
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
prompts: {
|
|
47
|
+
getAdditionalContextLines: (context) => {
|
|
48
|
+
const router = context.router;
|
|
49
|
+
const routerType = router === NextJsRouter.APP_ROUTER ? 'app' : 'pages';
|
|
50
|
+
return [`Router: ${routerType}`];
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
ui: {
|
|
54
|
+
successMessage: 'WorkOS AuthKit integration complete',
|
|
55
|
+
getOutroChanges: (context) => {
|
|
56
|
+
const router = context.router;
|
|
57
|
+
const routerName = getNextJsRouterName(router);
|
|
58
|
+
return [
|
|
59
|
+
`Analyzed your Next.js project structure (${routerName})`,
|
|
60
|
+
`Created and configured WorkOS AuthKit`,
|
|
61
|
+
`Integrated authentication into your application`,
|
|
62
|
+
];
|
|
63
|
+
},
|
|
64
|
+
getOutroNextSteps: () => [
|
|
65
|
+
'Start your development server to test authentication',
|
|
66
|
+
'Visit the WorkOS Dashboard to manage users and settings',
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
export async function run(options) {
|
|
71
|
+
if (options.debug) {
|
|
72
|
+
enableDebugLogs();
|
|
73
|
+
}
|
|
74
|
+
// Check Next.js version - agent wizard requires >= 15.3.0
|
|
75
|
+
const packageJson = await getPackageDotJson(options);
|
|
76
|
+
const nextVersion = getPackageVersion('next', packageJson);
|
|
77
|
+
if (nextVersion) {
|
|
78
|
+
const coercedVersion = semver.coerce(nextVersion);
|
|
79
|
+
if (coercedVersion && semver.lt(coercedVersion, MINIMUM_NEXTJS_VERSION)) {
|
|
80
|
+
const docsUrl = config.metadata.unsupportedVersionDocsUrl ?? config.metadata.docsUrl;
|
|
81
|
+
clack.log.warn(`Sorry: the installer can't help you with Next.js ${nextVersion}. Upgrade to Next.js ${MINIMUM_NEXTJS_VERSION} or later, or check out the manual setup guide.`);
|
|
82
|
+
clack.log.info(`Setup Next.js manually: ${chalk.cyan(docsUrl)}`);
|
|
83
|
+
clack.outro('WorkOS AuthKit installer will see you next time!');
|
|
84
|
+
return '';
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
const { runAgentInstaller } = await import('../../lib/agent-runner.js');
|
|
88
|
+
return runAgentInstaller(config, options);
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/integrations/nextjs/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,eAAe,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAExG,MAAM,sBAAsB,GAAG,QAAQ,CAAC;AAExC,MAAM,CAAC,MAAM,MAAM,GAAoB;IACrC,QAAQ,EAAE;QACR,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,QAAQ;QACrB,OAAO,EAAE,wDAAwD;QACjE,yBAAyB,EAAE,wDAAwD;QACnF,SAAS,EAAE,uBAAuB;QAClC,QAAQ,EAAE,YAAY;QACtB,SAAS,EAAE,QAAQ;QACnB,QAAQ,EAAE,GAAG;QACb,aAAa,EAAE,KAAK,EAAE,OAAyB,EAAE,EAAE;YACjD,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,OAAO,CAAC,CAAC;YAC9C,OAAO,EAAE,MAAM,EAAE,CAAC;QACpB,CAAC;KACF;IAED,SAAS,EAAE;QACT,WAAW,EAAE,MAAM;QACnB,kBAAkB,EAAE,SAAS;QAC7B,UAAU,EAAE,CAAC,WAAgB,EAAE,EAAE,CAAC,iBAAiB,CAAC,MAAM,EAAE,WAAW,CAAC;QACx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AClB,eAAe,EAAE,CAAC;IACpB,CAAC;IAED,0DAA0D;IAC1D,MAAM,WAAW,GAAG,MAAM,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACrD,MAAM,WAAW,GAAG,iBAAiB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAE3D,IAAI,WAAW,EAAE,CAAC;QAChB,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAClD,IAAI,cAAc,IAAI,MAAM,CAAC,EAAE,CAAC,cAAc,EAAE,sBAAsB,CAAC,EAAE,CAAC;YACxE,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,yBAAyB,IAAI,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC;YAErF,KAAK,CAAC,GAAG,CAAC,IAAI,CACZ,oDAAoD,WAAW,wBAAwB,sBAAsB,iDAAiD,CAC/J,CAAC;YACF,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,2BAA2B,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YACjE,KAAK,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAC;YAChE,OAAO,EAAE,CAAC;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":["/* Next.js 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 { getNextJsRouter, getNextJsVersionBucket, getNextJsRouterName, NextJsRouter } from './utils.js';\n\nconst MINIMUM_NEXTJS_VERSION = '15.3.0';\n\nexport const config: FrameworkConfig = {\n metadata: {\n name: 'Next.js',\n integration: 'nextjs',\n docsUrl: 'https://workos.com/docs/user-management/authkit/nextjs',\n unsupportedVersionDocsUrl: 'https://workos.com/docs/user-management/authkit/nextjs',\n skillName: 'workos-authkit-nextjs',\n language: 'javascript',\n stability: 'stable',\n priority: 100,\n gatherContext: async (options: InstallerOptions) => {\n const router = await getNextJsRouter(options);\n return { router };\n },\n },\n\n detection: {\n packageName: 'next',\n packageDisplayName: 'Next.js',\n getVersion: (packageJson: any) => getPackageVersion('next', packageJson),\n getVersionBucket: getNextJsVersionBucket,\n },\n\n environment: {\n uploadToHosting: true,\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 router = context.router as NextJsRouter;\n return {\n router: router === NextJsRouter.APP_ROUTER ? 'app' : 'pages',\n };\n },\n },\n\n prompts: {\n getAdditionalContextLines: (context: any) => {\n const router = context.router as NextJsRouter;\n const routerType = router === NextJsRouter.APP_ROUTER ? 'app' : 'pages';\n return [`Router: ${routerType}`];\n },\n },\n\n ui: {\n successMessage: 'WorkOS AuthKit integration complete',\n getOutroChanges: (context: any) => {\n const router = context.router as NextJsRouter;\n const routerName = getNextJsRouterName(router);\n return [\n `Analyzed your Next.js project structure (${routerName})`,\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 // Check Next.js version - agent wizard requires >= 15.3.0\n const packageJson = await getPackageDotJson(options);\n const nextVersion = getPackageVersion('next', packageJson);\n\n if (nextVersion) {\n const coercedVersion = semver.coerce(nextVersion);\n if (coercedVersion && semver.lt(coercedVersion, MINIMUM_NEXTJS_VERSION)) {\n const docsUrl = config.metadata.unsupportedVersionDocsUrl ?? config.metadata.docsUrl;\n\n clack.log.warn(\n `Sorry: the installer can't help you with Next.js ${nextVersion}. Upgrade to Next.js ${MINIMUM_NEXTJS_VERSION} or later, or check out the manual setup guide.`,\n );\n clack.log.info(`Setup Next.js 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,8 @@
|
|
|
1
|
+
import type { InstallerOptions } from '../../utils/types.js';
|
|
2
|
+
export declare function getNextJsVersionBucket(version: string | undefined): string;
|
|
3
|
+
export declare enum NextJsRouter {
|
|
4
|
+
APP_ROUTER = "app-router",
|
|
5
|
+
PAGES_ROUTER = "pages-router"
|
|
6
|
+
}
|
|
7
|
+
export declare function getNextJsRouter({ installDir }: Pick<InstallerOptions, 'installDir'>): Promise<NextJsRouter>;
|
|
8
|
+
export declare const getNextJsRouterName: (router: NextJsRouter) => "app router" | "pages router";
|