( targetDir: string, name: string, options: CreateAppOptions, interactive: boolean, )
| 170 | } |
| 171 | |
| 172 | async function writeCloudEnv( |
| 173 | targetDir: string, |
| 174 | name: string, |
| 175 | options: CreateAppOptions, |
| 176 | interactive: boolean, |
| 177 | ): Promise<boolean> { |
| 178 | let apiKey: string | null = null; |
| 179 | try { |
| 180 | const resolved = await resolveCloudApiKey({ |
| 181 | apiKey: options.apiKey, |
| 182 | auth: options.auth, |
| 183 | projectName: name, |
| 184 | interactive, |
| 185 | }); |
| 186 | apiKey = resolved.key; |
| 187 | telemetry.capture("cli_cloud_auth_method", { |
| 188 | method: resolved.method, |
| 189 | succeeded: apiKey != null, |
| 190 | }); |
| 191 | } catch (err) { |
| 192 | const msg = err instanceof Error ? err.message : String(err); |
| 193 | console.error(`\n⚠ Could not obtain an API key: ${msg}`); |
| 194 | console.error(` Add THESYS_API_KEY to .env later (keys: ${THESYS_KEYS_URL}).\n`); |
| 195 | } |
| 196 | const lines = [`THESYS_API_KEY=${apiKey ?? ""}`, `DEMO_USER_ID=demo-user`]; |
| 197 | fs.writeFileSync(path.join(targetDir, ".env"), lines.join("\n") + "\n"); |
| 198 | return apiKey != null; |
| 199 | } |
| 200 | |
| 201 | function getStartedMessage(o: { |
| 202 | name: string; |
no test coverage detected