@eide/foir-cli 0.11.2 → 0.11.3

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 (2) hide show
  1. package/dist/cli.js +35 -4
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -3478,9 +3478,12 @@ function registerSelectProjectCommand(program2, globalOpts) {
3478
3478
  selectedProject = projects.find((p) => p.id === projectId);
3479
3479
  }
3480
3480
  console.log("\nProvisioning API key for CLI access...");
3481
- await client.identity.switchTenant(selectedProject.tenantId);
3482
- await client.identity.switchProject(selectedProject.id);
3483
- const { apiKey, apiKeyId } = await provisionApiKey(client);
3481
+ const scopedClient = createPlatformClientWithHeaders(apiUrl, {
3482
+ Authorization: `Bearer ${credentials.accessToken}`,
3483
+ "x-tenant-id": selectedProject.tenantId,
3484
+ "x-project-id": selectedProject.id
3485
+ });
3486
+ const { apiKey, apiKeyId } = await provisionApiKey(scopedClient);
3484
3487
  await writeProjectContext(
3485
3488
  {
3486
3489
  id: selectedProject.id,
@@ -5693,8 +5696,24 @@ function registerPushCommand(program2, globalOpts) {
5693
5696
  );
5694
5697
  }
5695
5698
  const gOpts = globalOpts();
5696
- const client = await createPlatformClient(gOpts);
5697
5699
  const resolved = await resolveProjectContext(gOpts);
5700
+ const pin = config2.project;
5701
+ if (pin) {
5702
+ if (!resolved) {
5703
+ throw new Error(
5704
+ `foir.config.ts is pinned to project "${pin.name ?? pin.id}" (${pin.id}), but no project context is selected. Run \`foir select-project\` first.`
5705
+ );
5706
+ }
5707
+ if (resolved.project.id !== pin.id || resolved.project.tenantId !== pin.tenantId) {
5708
+ throw new Error(
5709
+ `Project mismatch \u2014 refusing to push.
5710
+ foir.config.ts pin: ${pin.name ?? pin.id} (${pin.id})
5711
+ resolved (${resolved.source}): ${resolved.project.name} (${resolved.project.id})
5712
+ Hand-edit foir.config.ts or run \`foir select-project\` to align them.`
5713
+ );
5714
+ }
5715
+ }
5716
+ const client = await createPlatformClient(gOpts);
5698
5717
  console.log(
5699
5718
  chalk6.dim(`Pushing config "${config2.key}" to platform...`)
5700
5719
  );
@@ -5747,6 +5766,18 @@ function registerPushCommand(program2, globalOpts) {
5747
5766
  console.log(` Config Key: ${chalk6.cyan(config2.key)}`);
5748
5767
  console.log();
5749
5768
  printSummary(summary);
5769
+ if (!pin && resolved) {
5770
+ console.log();
5771
+ console.log(chalk6.dim("Tip: pin this folder to its project by adding the following to foir.config.ts:"));
5772
+ console.log(chalk6.dim(" project: {"));
5773
+ console.log(chalk6.dim(` id: '${resolved.project.id}',`));
5774
+ console.log(chalk6.dim(` tenantId: '${resolved.project.tenantId}',`));
5775
+ if (resolved.project.name) {
5776
+ console.log(chalk6.dim(` name: '${resolved.project.name}',`));
5777
+ }
5778
+ console.log(chalk6.dim(" },"));
5779
+ console.log(chalk6.dim("Future pushes will refuse to run if the resolved project drifts from this id."));
5780
+ }
5750
5781
  const envPath = resolve4(opts.env ?? ".env");
5751
5782
  const envWrites = [];
5752
5783
  for (const pk of summary.apiKeys) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eide/foir-cli",
3
- "version": "0.11.2",
3
+ "version": "0.11.3",
4
4
  "description": "Universal platform CLI for Foir platform",
5
5
  "type": "module",
6
6
  "publishConfig": {