@indigoai-us/hq-cli 5.122.0 → 5.122.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/CHANGELOG.md CHANGED
@@ -2,8 +2,17 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [5.122.1] — 2026-09-19
6
+
5
7
  ### Fixed
6
8
 
9
+ - `hq cloud provision company` no longer silently accepts a server-suffixed
10
+ slug. When another owner already holds the requested name, the vault assigns
11
+ `<slug>-<tag>` and used to write local config as if the original name had
12
+ been granted — sync then cannot push, because it looks for a folder matching
13
+ the cloud slug. Provision now fails before writing, and retires the
14
+ just-created entity so it does not leave a suffixed orphan.
15
+
7
16
  - Work Mesh now keeps the company you selected when its session context is
8
17
  acknowledged or recovered after a restart. Mesh activity stays attached to
9
18
  the right company instead of being held for missing attribution.
@@ -513,6 +513,52 @@ export async function provisionCompany(options) {
513
513
  createdEntity = true;
514
514
  log(`created vault entity uid=${entity.uid}`);
515
515
  }
516
+ // hq-pro auto-suffixes a company slug when another owner already holds the
517
+ // bare name (`<slug>-<ownerTag>`). `/entity/check-slug/me` only looks at the
518
+ // caller's namespace, so it reports "available" and we POST; the server then
519
+ // returns a different slug. Writing companies/<requested>/.hq/config.json
520
+ // with the requested slug (or syncing with --company <assigned>) leaves the
521
+ // local folder and the cloud slug pointing at two different paths — share()
522
+ // derives syncRoot from ctx.slug, so the company can never be pushed.
523
+ // Fail before any local write. Retire a just-created entity so we do not
524
+ // leave a suffixed orphan.
525
+ if (entity.slug !== options.slug) {
526
+ const assigned = entity.slug || "(missing)";
527
+ let retired = false;
528
+ if (createdEntity) {
529
+ try {
530
+ await vaultClient.softDeleteCompany(entity.uid);
531
+ retired = true;
532
+ log(`retired vault entity uid=${entity.uid} — assigned slug ${assigned} differs from requested ${options.slug}`);
533
+ }
534
+ catch (err) {
535
+ const msg = err instanceof Error ? err.message : String(err);
536
+ log(`failed to retire mismatched vault entity uid=${entity.uid}: ${msg}`);
537
+ }
538
+ }
539
+ const retireNote = retired
540
+ ? `The just-created entity ${entity.uid} was retired.`
541
+ : createdEntity
542
+ ? `Retire entity ${entity.uid} with \`hq cloud retire company\`, then retry after the original slug is free.`
543
+ : `Existing entity ${entity.uid} was not modified.`;
544
+ throw new ProvisionError(1, `Cloud assigned slug "${assigned}" instead of requested "${options.slug}". ` +
545
+ `Local folder is companies/${options.slug}; sync derives the company folder from the cloud slug, so this company cannot be pushed. ` +
546
+ `${retireNote} Ask an admin to release the original slug, or rename the local folder to "${assigned}" and re-run.`, {
547
+ ok: false,
548
+ company_slug: options.slug,
549
+ cloud_uid: entity.uid,
550
+ bucket_name: entity.bucketName ?? "",
551
+ vault_api_url: options.vaultApiUrl,
552
+ kms_key_id: entity.kmsKeyId ?? null,
553
+ created_entity: createdEntity,
554
+ manifest_patched: false,
555
+ config_written: false,
556
+ initial_sync: {
557
+ ok: false,
558
+ error: `assigned slug "${assigned}" differs from requested "${options.slug}"`,
559
+ },
560
+ });
561
+ }
516
562
  if (!entity.bucketName) {
517
563
  // Vault returned an entity without a bucket — this would happen if the
518
564
  // provisioning Lambda asynchronously failed. We have a `cloud_uid` but
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indigoai-us/hq-cli",
3
- "version": "5.122.0",
3
+ "version": "5.122.1",
4
4
  "description": "HQ by Indigo management CLI \u2014 modules and cloud sync",
5
5
  "main": "dist/index.js",
6
6
  "bin": {