@seeka-labs/cli-apps-azure 3.10.0 → 3.10.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.
package/dist/index.cjs CHANGED
@@ -5730,7 +5730,7 @@ var require_commander = __commonJS({
5730
5730
  var version;
5731
5731
  var init_package = __esm({
5732
5732
  "../cli-apps/package.json"() {
5733
- version = "3.10.0";
5733
+ version = "3.10.1";
5734
5734
  }
5735
5735
  });
5736
5736
 
@@ -33490,140 +33490,6 @@ var init_auth = __esm({
33490
33490
  }
33491
33491
  });
33492
33492
 
33493
- // src/github/services/repo/index.ts
33494
- async function createRepository(octokit, options) {
33495
- try {
33496
- console.log(`
33497
- \u{1F4E6} Creating GitHub repository: ${options.name}...`);
33498
- let data;
33499
- if (options.org) {
33500
- const response = await octokit.repos.createInOrg({
33501
- org: options.org,
33502
- name: options.name,
33503
- description: options.description || `Seeka app: ${options.name}`,
33504
- private: options.private ?? true,
33505
- auto_init: true
33506
- // Initialize with README
33507
- });
33508
- data = response.data;
33509
- } else {
33510
- const response = await octokit.repos.createForAuthenticatedUser({
33511
- name: options.name,
33512
- description: options.description || `Seeka app: ${options.name}`,
33513
- private: options.private ?? true,
33514
- auto_init: true
33515
- // Initialize with README
33516
- });
33517
- data = response.data;
33518
- }
33519
- console.log(`\u2713 Repository created: ${data.html_url}
33520
- `);
33521
- await createBranchRuleset(octokit, data.owner.login, data.name);
33522
- return {
33523
- owner: data.owner.login,
33524
- repo: data.name
33525
- };
33526
- } catch (error) {
33527
- if (error.status === 422) {
33528
- throw new Error(`Repository '${options.name}' already exists`);
33529
- }
33530
- throw new Error(`Failed to create repository: ${error.message}`);
33531
- }
33532
- }
33533
- async function deleteRepositoryVariable(octokit, owner, repo, variableName) {
33534
- try {
33535
- await octokit.actions.deleteRepoVariable({
33536
- owner,
33537
- repo,
33538
- name: variableName
33539
- });
33540
- console.log(` \u2713 Deleted repository variable: ${variableName}`);
33541
- } catch (error) {
33542
- if (error.status === 404) {
33543
- return;
33544
- }
33545
- throw new Error(`Failed to delete repository variable '${variableName}': ${error.message}`);
33546
- }
33547
- }
33548
- async function getAuthenticatedUser(octokit) {
33549
- try {
33550
- const { data } = await octokit.users.getAuthenticated();
33551
- return data.login;
33552
- } catch (error) {
33553
- throw new Error(`Failed to get authenticated user: ${error.message}`);
33554
- }
33555
- }
33556
- async function getUserOrganizations(octokit) {
33557
- try {
33558
- const { data } = await octokit.orgs.listForAuthenticatedUser();
33559
- return data.map((org) => ({
33560
- login: org.login,
33561
- description: org.description
33562
- }));
33563
- } catch (error) {
33564
- throw new Error(`Failed to get user organizations: ${error.message}`);
33565
- }
33566
- }
33567
- async function createBranchRuleset(octokit, owner, repo) {
33568
- try {
33569
- console.log(`\u{1F6E1}\uFE0F Creating branch ruleset: "Org admins only allowed to commit to main branch"...`);
33570
- await octokit.request("POST /repos/{owner}/{repo}/rulesets", {
33571
- owner,
33572
- repo,
33573
- name: "Org admins only allowed to commit to main branch",
33574
- target: "branch",
33575
- enforcement: "active",
33576
- conditions: {
33577
- ref_name: {
33578
- include: ["refs/heads/main"],
33579
- exclude: []
33580
- }
33581
- },
33582
- rules: [
33583
- {
33584
- type: "pull_request",
33585
- parameters: {
33586
- required_approving_review_count: 1,
33587
- dismiss_stale_reviews_on_push: false,
33588
- require_code_owner_review: false,
33589
- require_last_push_approval: false,
33590
- required_review_thread_resolution: false
33591
- }
33592
- },
33593
- {
33594
- type: "creation"
33595
- },
33596
- {
33597
- type: "update"
33598
- },
33599
- {
33600
- type: "deletion"
33601
- },
33602
- {
33603
- type: "non_fast_forward"
33604
- }
33605
- ],
33606
- bypass_actors: [
33607
- {
33608
- actor_id: 1,
33609
- // Organization admin role
33610
- actor_type: "OrganizationAdmin",
33611
- bypass_mode: "always"
33612
- }
33613
- ]
33614
- });
33615
- console.log(` \u2713 Branch ruleset created successfully
33616
- `);
33617
- } catch (error) {
33618
- throw new Error(`Failed to create branch ruleset: ${error.message}`);
33619
- }
33620
- }
33621
- var init_repo = __esm({
33622
- "src/github/services/repo/index.ts"() {
33623
- "use strict";
33624
- }
33625
- });
33626
-
33627
33493
  // ../../node_modules/libsodium/dist/modules-esm/libsodium.mjs
33628
33494
  var __filename, __dirname3, Module, Module, root, window_, crypto_, randomValuesStandard, crypto, randomValueNodeJS, _Module, libsodium_default;
33629
33495
  var init_libsodium = __esm({
@@ -80164,6 +80030,199 @@ var init_libsodium_wrappers = __esm({
80164
80030
  }
80165
80031
  });
80166
80032
 
80033
+ // src/github/services/repo/index.ts
80034
+ async function createRepository(octokit, options) {
80035
+ try {
80036
+ console.log(`
80037
+ \u{1F4E6} Creating GitHub repository: ${options.name}...`);
80038
+ let data;
80039
+ if (options.org) {
80040
+ const response = await octokit.repos.createInOrg({
80041
+ org: options.org,
80042
+ name: options.name,
80043
+ description: options.description || `Seeka app: ${options.name}`,
80044
+ private: options.private ?? true,
80045
+ auto_init: true
80046
+ // Initialize with README
80047
+ });
80048
+ data = response.data;
80049
+ } else {
80050
+ const response = await octokit.repos.createForAuthenticatedUser({
80051
+ name: options.name,
80052
+ description: options.description || `Seeka app: ${options.name}`,
80053
+ private: options.private ?? true,
80054
+ auto_init: true
80055
+ // Initialize with README
80056
+ });
80057
+ data = response.data;
80058
+ }
80059
+ console.log(`\u2713 Repository created: ${data.html_url}
80060
+ `);
80061
+ await createBranchRuleset(octokit, data.owner.login, data.name);
80062
+ return {
80063
+ owner: data.owner.login,
80064
+ repo: data.name
80065
+ };
80066
+ } catch (error) {
80067
+ if (error.status === 422) {
80068
+ throw new Error(`Repository '${options.name}' already exists`);
80069
+ }
80070
+ throw new Error(`Failed to create repository: ${error.message}`);
80071
+ }
80072
+ }
80073
+ async function setRepositoryVariable(octokit, owner, repo, variable) {
80074
+ try {
80075
+ let exists = false;
80076
+ try {
80077
+ await octokit.actions.getRepoVariable({
80078
+ owner,
80079
+ repo,
80080
+ name: variable.name
80081
+ });
80082
+ exists = true;
80083
+ } catch (error) {
80084
+ if (error.status !== 404) {
80085
+ throw error;
80086
+ }
80087
+ }
80088
+ if (exists) {
80089
+ await octokit.actions.updateRepoVariable({
80090
+ owner,
80091
+ repo,
80092
+ name: variable.name,
80093
+ value: variable.value
80094
+ });
80095
+ } else {
80096
+ await octokit.actions.createRepoVariable({
80097
+ owner,
80098
+ repo,
80099
+ name: variable.name,
80100
+ value: variable.value
80101
+ });
80102
+ }
80103
+ console.log(` \u2713 Set repository variable: ${variable.name}`);
80104
+ } catch (error) {
80105
+ throw new Error(`Failed to set repository variable '${variable.name}': ${error.message}`);
80106
+ }
80107
+ }
80108
+ async function deleteRepositoryVariable(octokit, owner, repo, variableName) {
80109
+ try {
80110
+ await octokit.actions.deleteRepoVariable({
80111
+ owner,
80112
+ repo,
80113
+ name: variableName
80114
+ });
80115
+ console.log(` \u2713 Deleted repository variable: ${variableName}`);
80116
+ } catch (error) {
80117
+ if (error.status === 404) {
80118
+ return;
80119
+ }
80120
+ throw new Error(`Failed to delete repository variable '${variableName}': ${error.message}`);
80121
+ }
80122
+ }
80123
+ async function getAuthenticatedUser(octokit) {
80124
+ try {
80125
+ const { data } = await octokit.users.getAuthenticated();
80126
+ return data.login;
80127
+ } catch (error) {
80128
+ throw new Error(`Failed to get authenticated user: ${error.message}`);
80129
+ }
80130
+ }
80131
+ async function getUserOrganizations(octokit) {
80132
+ try {
80133
+ const { data } = await octokit.orgs.listForAuthenticatedUser();
80134
+ return data.map((org) => ({
80135
+ login: org.login,
80136
+ description: org.description
80137
+ }));
80138
+ } catch (error) {
80139
+ throw new Error(`Failed to get user organizations: ${error.message}`);
80140
+ }
80141
+ }
80142
+ async function createBranchRuleset(octokit, owner, repo) {
80143
+ try {
80144
+ console.log(`\u{1F6E1}\uFE0F Creating branch ruleset: "Org admins only allowed to commit to main branch"...`);
80145
+ await octokit.request("POST /repos/{owner}/{repo}/rulesets", {
80146
+ owner,
80147
+ repo,
80148
+ name: "Org admins only allowed to commit to main branch",
80149
+ target: "branch",
80150
+ enforcement: "active",
80151
+ conditions: {
80152
+ ref_name: {
80153
+ include: ["refs/heads/main"],
80154
+ exclude: []
80155
+ }
80156
+ },
80157
+ rules: [
80158
+ {
80159
+ type: "pull_request",
80160
+ parameters: {
80161
+ required_approving_review_count: 1,
80162
+ dismiss_stale_reviews_on_push: false,
80163
+ require_code_owner_review: false,
80164
+ require_last_push_approval: false,
80165
+ required_review_thread_resolution: false
80166
+ }
80167
+ },
80168
+ {
80169
+ type: "creation"
80170
+ },
80171
+ {
80172
+ type: "update"
80173
+ },
80174
+ {
80175
+ type: "deletion"
80176
+ },
80177
+ {
80178
+ type: "non_fast_forward"
80179
+ }
80180
+ ],
80181
+ bypass_actors: [
80182
+ {
80183
+ actor_id: 1,
80184
+ // Organization admin role
80185
+ actor_type: "OrganizationAdmin",
80186
+ bypass_mode: "always"
80187
+ }
80188
+ ]
80189
+ });
80190
+ console.log(` \u2713 Branch ruleset created successfully
80191
+ `);
80192
+ } catch (error) {
80193
+ throw new Error(`Failed to create branch ruleset: ${error.message}`);
80194
+ }
80195
+ }
80196
+ async function encryptSecretValue(value, base64PublicKey) {
80197
+ await libsodium_wrappers_default.ready;
80198
+ const messageBytes = libsodium_wrappers_default.from_string(value);
80199
+ const keyBytes = libsodium_wrappers_default.from_base64(base64PublicKey, libsodium_wrappers_default.base64_variants.ORIGINAL);
80200
+ const encryptedBytes = libsodium_wrappers_default.crypto_box_seal(messageBytes, keyBytes);
80201
+ return libsodium_wrappers_default.to_base64(encryptedBytes, libsodium_wrappers_default.base64_variants.ORIGINAL);
80202
+ }
80203
+ async function setRepositorySecret(octokit, owner, repo, secret) {
80204
+ try {
80205
+ const { data: keyData } = await octokit.actions.getRepoPublicKey({ owner, repo });
80206
+ const encrypted_value = await encryptSecretValue(secret.value, keyData.key);
80207
+ await octokit.actions.createOrUpdateRepoSecret({
80208
+ owner,
80209
+ repo,
80210
+ secret_name: secret.name,
80211
+ encrypted_value,
80212
+ key_id: keyData.key_id
80213
+ });
80214
+ console.log(` \u2713 Set repository secret: ${secret.name}`);
80215
+ } catch (error) {
80216
+ throw new Error(`Failed to set repository secret '${secret.name}': ${error.message}`);
80217
+ }
80218
+ }
80219
+ var init_repo = __esm({
80220
+ "src/github/services/repo/index.ts"() {
80221
+ "use strict";
80222
+ init_libsodium_wrappers();
80223
+ }
80224
+ });
80225
+
80167
80226
  // src/github/services/environment/index.ts
80168
80227
  async function createEnvironment(octokit, owner, repo, environmentName) {
80169
80228
  try {
@@ -80230,7 +80289,7 @@ async function getEnvironmentPublicKey(octokit, owner, repo, environmentName) {
80230
80289
  key_id: data.key_id
80231
80290
  };
80232
80291
  }
80233
- async function encryptSecretValue(value, base64PublicKey) {
80292
+ async function encryptSecretValue2(value, base64PublicKey) {
80234
80293
  await libsodium_wrappers_default.ready;
80235
80294
  const messageBytes = libsodium_wrappers_default.from_string(value);
80236
80295
  const keyBytes = libsodium_wrappers_default.from_base64(base64PublicKey, libsodium_wrappers_default.base64_variants.ORIGINAL);
@@ -80240,7 +80299,7 @@ async function encryptSecretValue(value, base64PublicKey) {
80240
80299
  async function setEnvironmentSecret(octokit, owner, repo, environmentName, secret) {
80241
80300
  try {
80242
80301
  const { key, key_id } = await getEnvironmentPublicKey(octokit, owner, repo, environmentName);
80243
- const encrypted_value = await encryptSecretValue(secret.value, key);
80302
+ const encrypted_value = await encryptSecretValue2(secret.value, key);
80244
80303
  await octokit.actions.createOrUpdateEnvironmentSecret({
80245
80304
  owner,
80246
80305
  repo,
@@ -104662,7 +104721,7 @@ npmScopes:
104662
104721
  var version2;
104663
104722
  var init_package2 = __esm({
104664
104723
  "package.json"() {
104665
- version2 = "3.10.0";
104724
+ version2 = "3.10.1";
104666
104725
  }
104667
104726
  });
104668
104727
 
@@ -105035,6 +105094,18 @@ async function initAppCommand2(config) {
105035
105094
  private: true,
105036
105095
  org: selectedOwner
105037
105096
  });
105097
+ if (answers.npmUsername) {
105098
+ await setRepositoryVariable(octokit, owner, repo, {
105099
+ name: "INTERNAL_NPM_AUTH_USERNAME",
105100
+ value: answers.npmUsername
105101
+ });
105102
+ }
105103
+ if (answers.npmPassword) {
105104
+ await setRepositorySecret(octokit, owner, repo, {
105105
+ name: "INTERNAL_NPM_AUTH_PASSWORD",
105106
+ value: answers.npmPassword
105107
+ });
105108
+ }
105038
105109
  const prodEnvironmentName = `prod`;
105039
105110
  await createEnvironment(octokit, owner, repo, prodEnvironmentName);
105040
105111
  await setEnvironmentVariables(octokit, owner, repo, prodEnvironmentName, [
@@ -105207,72 +105278,81 @@ async function initEnvironmentCommand(config) {
105207
105278
  const environmentType = envTypeAnswer.environmentType;
105208
105279
  const isStaging = environmentType === "staging";
105209
105280
  const defaultEnvName = isStaging ? "stag" : "prod";
105281
+ const appConfigPath = resolveAppConfigPath(process.cwd());
105282
+ const appConfig = readJsonFile(appConfigPath);
105283
+ const defaultGithubOwner = appConfig?.githubOwner ?? "";
105284
+ const defaultAppName = appConfig?.appName ?? config.appName;
105285
+ const existingEnvConfigPath = resolveEnvironmentConfigPath(process.cwd(), defaultEnvName);
105286
+ const existingEnvConfig = readJsonFile(existingEnvConfigPath);
105210
105287
  const envSecretsPath = resolveEnvironmentSecretsConfigPath(defaultEnvName);
105211
105288
  let envSecretsConfig = readInitConfig(envSecretsPath);
105212
105289
  if (!envSecretsConfig && !isStaging) {
105213
105290
  const legacyPath = resolveSecretsConfigPath();
105214
105291
  envSecretsConfig = readInitConfig(legacyPath);
105215
105292
  }
105216
- const envDefaults = isStaging ? {} : envSecretsConfig?.environmentVariables ?? {};
105293
+ const envDefaults = existingEnvConfig?.environmentVariables ?? envSecretsConfig?.environmentVariables ?? {};
105294
+ const defaultAzureRg = existingEnvConfig?.azureFunctionResourceGroupName ?? config.azureFunctionResourceGroupName ?? "";
105295
+ const defaultAzureFuncResourceName = existingEnvConfig?.azureFunctionResourceName ?? "";
105217
105296
  const answers = await dist_default12.prompt([
105218
105297
  {
105219
105298
  type: "input",
105220
105299
  name: "owner",
105221
105300
  message: addEnvCommand.interactive.owner.message,
105301
+ default: defaultGithubOwner,
105222
105302
  validate: (input) => input.trim() !== "" || addEnvCommand.interactive.owner.validation.required
105223
105303
  },
105224
105304
  {
105225
105305
  type: "input",
105226
105306
  name: "repo",
105227
105307
  message: addEnvCommand.interactive.repo.message,
105228
- default: `seeka-app-${config.appName}`,
105308
+ default: `seeka-app-${defaultAppName}`,
105229
105309
  validate: (input) => input.trim() !== "" || addEnvCommand.interactive.repo.validation.required
105230
105310
  },
105231
105311
  {
105232
105312
  type: "input",
105233
105313
  name: "environmentName",
105234
105314
  message: addEnvCommand.interactive.environmentName.message,
105235
- default: isStaging ? "stag" : "prod",
105315
+ default: defaultEnvName,
105236
105316
  validate: (input) => input.trim() !== "" || addEnvCommand.interactive.environmentName.validation.required
105237
105317
  },
105238
105318
  {
105239
105319
  type: "input",
105240
105320
  name: "azureFunctionResourceGroupName",
105241
105321
  message: addEnvCommand.interactive.azureFunctionResourceGroupName.message,
105242
- default: config.azureFunctionResourceGroupName ?? "",
105322
+ default: defaultAzureRg,
105243
105323
  validate: (input) => input.trim() !== "" || addEnvCommand.interactive.azureFunctionResourceGroupName.validation.required
105244
105324
  },
105245
105325
  {
105246
105326
  type: "input",
105247
105327
  name: "azureFuncResourceName",
105248
105328
  message: sharedEnvConfigPrompts.azureFuncResourceName.message,
105249
- default: isStaging ? `seeka-app-${config.appName}-staging` : `seeka-app-${config.appName}`,
105329
+ default: defaultAzureFuncResourceName || (isStaging ? `seeka-app-${defaultAppName}-staging` : `seeka-app-${defaultAppName}`),
105250
105330
  validate: (input) => input.trim() !== "" || sharedEnvConfigPrompts.azureFuncResourceName.validation.required
105251
105331
  },
105252
105332
  {
105253
105333
  type: "input",
105254
105334
  name: "viteBaseUrl",
105255
105335
  message: addEnvCommand.interactive.viteBaseUrl.message,
105256
- default: `/${config.appName}/app/`,
105336
+ default: envDefaults.VITE_BASE_URL || `/${defaultAppName}/app/`,
105257
105337
  validate: (input) => input.trim() !== "" || addEnvCommand.interactive.viteBaseUrl.validation.required
105258
105338
  },
105259
105339
  {
105260
105340
  type: "input",
105261
105341
  name: "viteUrlsSeekaApiCore",
105262
105342
  message: addEnvCommand.interactive.viteUrlsSeekaApiCore.message,
105263
- default: ""
105343
+ default: envDefaults.VITE_URLS_SEEKA_API_CORE || ""
105264
105344
  },
105265
105345
  {
105266
105346
  type: "input",
105267
105347
  name: "viteUrlsSeekaAppCoreOrigin",
105268
105348
  message: addEnvCommand.interactive.viteUrlsSeekaAppCoreOrigin.message,
105269
- default: ""
105349
+ default: envDefaults.VITE_URLS_SEEKA_APP_CORE_ORIGIN || ""
105270
105350
  },
105271
105351
  {
105272
105352
  type: "input",
105273
105353
  name: "hostingEnvName",
105274
105354
  message: addEnvCommand.interactive.hostingEnvName.message,
105275
- default: isStaging ? "stag" : "prod",
105355
+ default: envDefaults.HOSTING_ENV_NAME || (isStaging ? "stag" : "prod"),
105276
105356
  validate: (input) => input.trim() !== "" || addEnvCommand.interactive.hostingEnvName.validation.required
105277
105357
  },
105278
105358
  {
@@ -105339,12 +105419,6 @@ async function initEnvironmentCommand(config) {
105339
105419
  message: sharedEnvConfigPrompts.otelExporterOtlpLogsHeaders.message,
105340
105420
  default: envDefaults.OTEL_EXPORTER_OTLP_LOGS_HEADERS ?? ""
105341
105421
  },
105342
- {
105343
- type: "input",
105344
- name: "selfHostBaseUrl",
105345
- message: sharedEnvConfigPrompts.selfHostBaseUrl.message,
105346
- default: isStaging ? `https://apps.seeka.services/${config.appName}-staging` : envDefaults.SELF_HOST_BASEURL ?? `https://apps.seeka.services/${config.appName}`
105347
- },
105348
105422
  {
105349
105423
  type: "input",
105350
105424
  name: "otelExporterOtlpTracesEndpoint",
@@ -105357,6 +105431,12 @@ async function initEnvironmentCommand(config) {
105357
105431
  message: sharedEnvConfigPrompts.otelExporterOtlpTracesHeaders.message,
105358
105432
  default: envDefaults.OTEL_EXPORTER_OTLP_TRACES_HEADERS ?? ""
105359
105433
  },
105434
+ {
105435
+ type: "input",
105436
+ name: "selfHostBaseUrl",
105437
+ message: sharedEnvConfigPrompts.selfHostBaseUrl.message,
105438
+ default: envDefaults.SELF_HOST_BASEURL || (isStaging ? `https://apps.seeka.services/${defaultAppName}-staging` : `https://apps.seeka.services/${defaultAppName}`)
105439
+ },
105360
105440
  {
105361
105441
  type: "input",
105362
105442
  name: "seekaIngestUrl",
@@ -105374,34 +105454,20 @@ async function initEnvironmentCommand(config) {
105374
105454
  name: "seekaTelemetryUrl",
105375
105455
  message: sharedEnvConfigPrompts.seekaTelemetryUrl.message,
105376
105456
  default: envDefaults.SEEKA_TELEMETRY_URL ?? ""
105377
- }
105378
- ]);
105379
- const { octokit } = await authenticateWithGitHub();
105380
- const configPath = config.__configPath ?? resolveInitConfigPath();
105381
- upsertInitConfig(configPath, {
105382
- orgName: config.orgName,
105383
- appName: config.appName,
105384
- azureFunctionResourceGroupName: answers.azureFunctionResourceGroupName
105385
- });
105386
- await setEnvironmentVariables(octokit, answers.owner, answers.repo, answers.environmentName, [
105457
+ },
105387
105458
  {
105388
- name: "AZURE_FUNC_RESOURCE_NAME",
105389
- value: answers.azureFuncResourceName
105459
+ type: "input",
105460
+ name: "internalNpmAuthUsername",
105461
+ message: "Enter internal NPM registry username (for pulling private @seeka-labs packages):",
105462
+ default: "internal-seeka-developers-apps"
105390
105463
  },
105391
105464
  {
105392
- name: "AZURE_FUNC_RESOURCE_GROUP_NAME",
105393
- value: answers.azureFunctionResourceGroupName
105465
+ type: "password",
105466
+ name: "internalNpmAuthPassword",
105467
+ message: "Enter internal NPM registry password (leave blank to skip updating the existing GitHub secret):",
105468
+ mask: "*"
105394
105469
  }
105395
105470
  ]);
105396
- try {
105397
- await deleteRepositoryVariable(octokit, answers.owner, answers.repo, "AZURE_FUNC_RESOURCE_NAME");
105398
- await deleteRepositoryVariable(octokit, answers.owner, answers.repo, "AZURE_FUNC_RESOURCE_GROUP_NAME");
105399
- console.log("\n\u26A0\uFE0F Repo-level AZURE_FUNC_RESOURCE_NAME and AZURE_FUNC_RESOURCE_GROUP_NAME have been removed.");
105400
- console.log(" Ensure your other environment also has these variables set at environment-level.");
105401
- console.log(" Run `seeka-azure update-env` for the other environment if needed.\n");
105402
- } catch {
105403
- }
105404
- await createEnvironment(octokit, answers.owner, answers.repo, answers.environmentName);
105405
105471
  const dataEncryptionKey = answers.dataEncryptionKey || generateGuidNoHyphens2();
105406
105472
  const envVars = {
105407
105473
  ...isStaging ? {} : config.environmentVariables ?? {},
@@ -105420,12 +105486,66 @@ async function initEnvironmentCommand(config) {
105420
105486
  SELF_HOST_BASEURL: answers.selfHostBaseUrl,
105421
105487
  SEEKA_INGEST_URL: answers.seekaIngestUrl,
105422
105488
  SEEKA_ISSUER_URL: answers.seekaIssuerUrl,
105423
- SEEKA_TELEMETRY_URL: answers.seekaTelemetryUrl
105424
- };
105489
+ SEEKA_TELEMETRY_URL: answers.seekaTelemetryUrl,
105490
+ // UI build-time vars (GitHub env-level vars, also persisted for re-use)
105491
+ VITE_BASE_URL: answers.viteBaseUrl,
105492
+ VITE_URLS_SEEKA_API_CORE: answers.viteUrlsSeekaApiCore,
105493
+ VITE_URLS_SEEKA_APP_CORE_ORIGIN: answers.viteUrlsSeekaAppCoreOrigin,
105494
+ HOSTING_ENV_NAME: answers.hostingEnvName
105495
+ };
105496
+ const appConfigWritePath = resolveAppConfigPath(process.cwd());
105497
+ const existingAppConfig = readJsonFile(appConfigWritePath);
105498
+ const mergedAppConfig = {
105499
+ orgName: config.orgName ?? existingAppConfig?.orgName ?? "",
105500
+ appName: config.appName ?? existingAppConfig?.appName ?? "",
105501
+ template: existingAppConfig?.template ?? "azure-function",
105502
+ githubOwner: answers.owner
105503
+ };
105504
+ writeJsonFile(appConfigWritePath, mergedAppConfig);
105425
105505
  const secretsConfigPath = resolveEnvironmentSecretsConfigPath(answers.environmentName);
105426
105506
  upsertSecretsConfig(secretsConfigPath, envVars);
105427
- const newEnvConfig = { environmentVariables: envVars };
105428
- writeJsonFile(resolveEnvironmentConfigPath(process.cwd(), answers.environmentName), newEnvConfig);
105507
+ const envConfigToWrite = {
105508
+ environmentVariables: envVars,
105509
+ azureFunctionResourceGroupName: answers.azureFunctionResourceGroupName,
105510
+ azureFunctionResourceName: answers.azureFuncResourceName,
105511
+ githubEnvironmentName: answers.environmentName
105512
+ };
105513
+ writeJsonFile(resolveEnvironmentConfigPath(process.cwd(), answers.environmentName), envConfigToWrite);
105514
+ console.log("\n\u{1F4BE} Saved inputs to .seeka/ locally. Re-run the command with the same env to resume if GitHub ops fail.\n");
105515
+ const { octokit } = await authenticateWithGitHub();
105516
+ if (answers.internalNpmAuthUsername) {
105517
+ await setRepositoryVariable(octokit, answers.owner, answers.repo, {
105518
+ name: "INTERNAL_NPM_AUTH_USERNAME",
105519
+ value: answers.internalNpmAuthUsername
105520
+ });
105521
+ }
105522
+ if (answers.internalNpmAuthPassword) {
105523
+ await setRepositorySecret(octokit, answers.owner, answers.repo, {
105524
+ name: "INTERNAL_NPM_AUTH_PASSWORD",
105525
+ value: answers.internalNpmAuthPassword
105526
+ });
105527
+ } else {
105528
+ console.log("\n \u23ED\uFE0F INTERNAL_NPM_AUTH_PASSWORD not provided - existing secret (if any) left in place.\n");
105529
+ }
105530
+ await createEnvironment(octokit, answers.owner, answers.repo, answers.environmentName);
105531
+ await setEnvironmentVariables(octokit, answers.owner, answers.repo, answers.environmentName, [
105532
+ {
105533
+ name: "AZURE_FUNC_RESOURCE_NAME",
105534
+ value: answers.azureFuncResourceName
105535
+ },
105536
+ {
105537
+ name: "AZURE_FUNC_RESOURCE_GROUP_NAME",
105538
+ value: answers.azureFunctionResourceGroupName
105539
+ }
105540
+ ]);
105541
+ try {
105542
+ await deleteRepositoryVariable(octokit, answers.owner, answers.repo, "AZURE_FUNC_RESOURCE_NAME");
105543
+ await deleteRepositoryVariable(octokit, answers.owner, answers.repo, "AZURE_FUNC_RESOURCE_GROUP_NAME");
105544
+ console.log("\n\u26A0\uFE0F Repo-level AZURE_FUNC_RESOURCE_NAME and AZURE_FUNC_RESOURCE_GROUP_NAME have been removed.");
105545
+ console.log(" Ensure your other environment also has these variables set at environment-level.");
105546
+ console.log(" Run `seeka-azure update-env` for the other environment if needed.\n");
105547
+ } catch {
105548
+ }
105429
105549
  const secretsToSet = [
105430
105550
  { name: "SEEKA_APP_CFG_DATA_ENCRYPTION_KEY", value: envVars.DATA_ENCRYPTION_KEY },
105431
105551
  { name: "SEEKA_APP_CFG_SEEKA_APP_SECRET", value: envVars.SEEKA_APP_SECRET },
@@ -105445,7 +105565,7 @@ async function initEnvironmentCommand(config) {
105445
105565
  },
105446
105566
  {
105447
105567
  name: "VITE_URLS_SEEKA_APP_CORE_ORIGIN",
105448
- value: "https://seeka.app"
105568
+ value: answers.viteUrlsSeekaAppCoreOrigin || "https://seeka.app"
105449
105569
  },
105450
105570
  {
105451
105571
  name: "HOSTING_ENV_NAME",
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seeka-labs/cli-apps-azure",
3
- "version": "3.10.0",
3
+ "version": "3.10.1",
4
4
  "type": "module",
5
5
  "description": "Seeka - Apps CLI - Azure",
6
6
  "author": "SEEKA <platform@seeka.co>",
@@ -33,7 +33,7 @@
33
33
  "devDependencies": {
34
34
  "@jest/globals": "^30",
35
35
  "@octokit/rest": "^22.0.1",
36
- "@seeka-labs/cli-apps": "3.10.0",
36
+ "@seeka-labs/cli-apps": "3.10.1",
37
37
  "@types/cross-spawn": "^6",
38
38
  "@types/jest": "^30",
39
39
  "@types/libsodium-wrappers": "^0.7",