@indigoai-us/hq-cli 5.345.207 → 5.345.208

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,6 +2,13 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [5.345.208] — 2026-11-06
6
+ - `hq storage offload --current` resolves files and folders to their on-disk spelling before choosing a vault, including discovery without path arguments. Company paths cannot be routed to the personal vault by different letter casing. Server-owned company paths are refused before membership, sync-journal or vault access, including synced files and restored library originals with a placeholder beside them. Their local bytes stay in place; output says the sync state was not checked.
7
+ - History offload excludes blobs with any company path, including blobs also recorded under personal paths. These versions stay in local history and are not uploaded to the personal vault or passed to the history rewrite. Personal-only history retains its existing upload and verification behavior.
8
+ - Fetch uses the same native path resolution for case-variant folder arguments and containment checks. This change does not repair placeholders or uploads left by earlier versions. Offload still conservatively refuses `board.json` and `ontology/entities/`; a vault failure for another eligible company file can still stop a run.
9
+
10
+ - This corrects the earlier broad offload claim: server-owned protection applies to current files only after canonical path resolution and before journal or vault access; company history is now excluded separately. Earlier releases do not provide these guarantees.
11
+
5
12
  ## [5.345.207] — 2026-11-05
6
13
  - `hq bot eb <name>` now restarts the running bots the change affects, the previous and the new Executive bot, each after its current reply (up to 2 minutes), so the daily Executive jobs move at once; it prints one line per bot, `--json` adds `restarted` and `skipped`, and `--no-restart` keeps the old behaviour.
7
14
 
@@ -5,7 +5,8 @@
5
5
  * for files over the sync limit approved 2026-10-15.
6
6
  *
7
7
  * Two kinds of big file:
8
- * - History copies (old versions inside the HQ root git history). The CLI
8
+ * - Personal-only history copies (old versions inside HQ root git history).
9
+ * Blobs with any company path are excluded, including shared blobs. The CLI
9
10
  * uploads each blob to the caller's PERSONAL vault, verifies size + sha256
10
11
  * + git blob id, then hands only verified blobs to core `hq-storage.sh
11
12
  * strip-large`, which rewrites history to the pointer text. Working-tree
@@ -378,7 +379,7 @@ export declare function heldWorktrees(held: LargeBlob[]): string[];
378
379
  export declare function worktreeHoldsAllCopy(held: LargeBlob[]): string;
379
380
  /**
380
381
  * History blobs eligible for offload: at least `minBytes`, and not part of the
381
- * current checkout. Blobs in HEAD are current files; stripping them would
382
+ * current checkout, with no company path. Blobs in HEAD are current files; stripping them would
382
383
  * leave the working tree out of step with HEAD.
383
384
  */
384
385
  export declare function selectHistoryBlobs(blobs: LargeBlob[], minBytes: number): LargeBlob[];
@@ -5,7 +5,8 @@
5
5
  * for files over the sync limit approved 2026-10-15.
6
6
  *
7
7
  * Two kinds of big file:
8
- * - History copies (old versions inside the HQ root git history). The CLI
8
+ * - Personal-only history copies (old versions inside HQ root git history).
9
+ * Blobs with any company path are excluded, including shared blobs. The CLI
9
10
  * uploads each blob to the caller's PERSONAL vault, verifies size + sha256
10
11
  * + git blob id, then hands only verified blobs to core `hq-storage.sh
11
12
  * strip-large`, which rewrites history to the pointer text. Working-tree
@@ -520,7 +521,7 @@ export function s3VaultObjectStore(bucket, s3, opts = {}) {
520
521
  */
521
522
  export function resolveOffloadTarget(rel) {
522
523
  const posix = toPosix(rel);
523
- const m = /^companies\/([^/]+)\/(.+)$/.exec(posix);
524
+ const m = /^companies\/([^/]+)\/(.+)$/i.exec(posix);
524
525
  if (m)
525
526
  return { vault: "company", slug: m[1], key: m[2] };
526
527
  return { vault: "personal", key: posix };
@@ -592,11 +593,14 @@ export function worktreeHoldsAllCopy(held) {
592
593
  }
593
594
  /**
594
595
  * History blobs eligible for offload: at least `minBytes`, and not part of the
595
- * current checkout. Blobs in HEAD are current files; stripping them would
596
+ * current checkout, with no company path. Blobs in HEAD are current files; stripping them would
596
597
  * leave the working tree out of step with HEAD.
597
598
  */
598
599
  export function selectHistoryBlobs(blobs, minBytes) {
599
- return blobs.filter((b) => !b.in_head && b.bytes >= minBytes && b.paths.length > 0);
600
+ // A blob may have both personal and company names. Never send any such
601
+ // content to the personal store; historical paths need no longer exist.
602
+ return blobs.filter((b) => !b.in_head && b.bytes >= minBytes && b.paths.length > 0 &&
603
+ b.paths.every((p) => !/^companies(?:\/|$)/i.test(toPosix(path.posix.normalize(toPosix(p))))));
600
604
  }
601
605
  // ── Upload + verify ─────────────────────────────────────────────────────────
602
606
  export function matchesDigest(obj, digest) {
@@ -672,11 +676,12 @@ export const durablePlaceholderFs = {
672
676
  export async function offloadCurrentFile(rel, store, deps, fsOps = durablePlaceholderFs) {
673
677
  if (store.vault !== "personal")
674
678
  throw new Error("Offload only writes to your personal vault.");
679
+ const abs = containedPath(deps.hqRoot, rel);
680
+ rel = toPosix(path.relative(fs.realpathSync.native(deps.hqRoot), abs));
675
681
  if (resolveOffloadTarget(rel).vault === "company") {
676
682
  throw new Error(`'${rel}' is a company file. Company files are never uploaded to your personal vault.`);
677
683
  }
678
684
  assertRestorable(rel);
679
- const abs = containedPath(deps.hqRoot, rel);
680
685
  const before = await fs.promises.stat(abs);
681
686
  if (!before.isFile())
682
687
  throw new Error(`'${rel}' is not a regular file.`);
@@ -1016,7 +1021,7 @@ function skippedByName(rel) {
1016
1021
  * Symlinks are not followed, and a path outside HQ throws.
1017
1022
  */
1018
1023
  function walkCurrentPaths(hqRoot, args) {
1019
- const realRoot = fs.realpathSync(path.resolve(hqRoot));
1024
+ const realRoot = fs.realpathSync.native(path.resolve(hqRoot));
1020
1025
  const out = [];
1021
1026
  const seen = new Set();
1022
1027
  const visit = (abs) => {
@@ -1055,10 +1060,12 @@ async function planCurrentFiles(rels, opts, deps, openVault) {
1055
1060
  let active;
1056
1061
  const planned = [];
1057
1062
  const now = deps.now().getTime();
1058
- for (const rel of rels) {
1063
+ for (const candidate of rels) {
1064
+ const abs = containedPath(deps.hqRoot, candidate);
1065
+ // Canonicalise discovery output too, not just explicit path arguments.
1066
+ const rel = toPosix(path.relative(fs.realpathSync.native(deps.hqRoot), abs));
1059
1067
  if (skippedByName(rel))
1060
1068
  continue;
1061
- const abs = containedPath(deps.hqRoot, rel);
1062
1069
  let st;
1063
1070
  try {
1064
1071
  st = fs.lstatSync(abs);
@@ -1093,6 +1100,15 @@ async function planCurrentFiles(rels, opts, deps, openVault) {
1093
1100
  };
1094
1101
  if (target.vault === "company") {
1095
1102
  plan.company = target.slug;
1103
+ // Decide this before any journal or vault access. A synced or
1104
+ // library-matching file would otherwise be replaced by a placeholder, and
1105
+ // a vault that cannot open would abort every other file in the run.
1106
+ if (deps.serverOwned?.(rel.toLowerCase())) {
1107
+ plan.excluded_by = "server-owned";
1108
+ plan.reason = exclusionReason({ excluded: true, layer: "server-owned" });
1109
+ planned.push({ plan, target });
1110
+ continue;
1111
+ }
1096
1112
  active ??= deps.activeCompanySlugs ? await deps.activeCompanySlugs() : [];
1097
1113
  if (!active.includes(target.slug)) {
1098
1114
  plan.reason = `You are not an active member of '${target.slug}'.`;
@@ -1143,9 +1159,7 @@ async function planCurrentFiles(rels, opts, deps, openVault) {
1143
1159
  plan.placeholder = "written";
1144
1160
  }
1145
1161
  else if (target.vault === "company") {
1146
- const ex = deps.serverOwned?.(rel)
1147
- ? { excluded: true, layer: "server-owned" }
1148
- : deps.syncExclusion?.(rel);
1162
+ const ex = deps.syncExclusion?.(rel);
1149
1163
  if (ex?.excluded) {
1150
1164
  plan.excluded_by = ex.layer ?? "ignore rules";
1151
1165
  plan.reason = exclusionReason(ex);
@@ -1473,14 +1487,14 @@ export function containedPath(hqRoot, rel) {
1473
1487
  if (abs !== root && !abs.startsWith(root + path.sep)) {
1474
1488
  throw new Error(`Path '${rel}' is outside HQ.`);
1475
1489
  }
1476
- const realRoot = fs.realpathSync(root);
1490
+ const realRoot = fs.realpathSync.native(root);
1477
1491
  let existing = abs;
1478
1492
  const rest = [];
1479
1493
  while (!fs.existsSync(existing)) {
1480
1494
  rest.unshift(path.basename(existing));
1481
1495
  existing = path.dirname(existing);
1482
1496
  }
1483
- const real = path.join(fs.realpathSync(existing), ...rest);
1497
+ const real = path.join(fs.realpathSync.native(existing), ...rest);
1484
1498
  if (real !== realRoot && !real.startsWith(realRoot + path.sep)) {
1485
1499
  throw new Error(`Path '${rel}' is outside HQ.`);
1486
1500
  }
@@ -1561,10 +1575,10 @@ async function fetchOrphan(pointer, opts, deps) {
1561
1575
  throw new Error(`${ORPHANED_MESSAGE} You have no personal copy of it to restore.`);
1562
1576
  }
1563
1577
  const dest = path.resolve(opts.out);
1564
- const realRoot = fs.realpathSync(path.resolve(deps.hqRoot));
1578
+ const realRoot = fs.realpathSync.native(path.resolve(deps.hqRoot));
1565
1579
  let realParent;
1566
1580
  try {
1567
- realParent = fs.realpathSync(path.dirname(dest));
1581
+ realParent = fs.realpathSync.native(path.dirname(dest));
1568
1582
  }
1569
1583
  catch {
1570
1584
  throw new Error(`The folder for '${opts.out}' does not exist.`);
@@ -1591,7 +1605,7 @@ async function fetchPlaceholder(arg, deps, opts) {
1591
1605
  if (opts.forceOrphan)
1592
1606
  throw new Error("--force-orphan is only for files a teammate deleted.");
1593
1607
  const target = containedPath(deps.hqRoot, pointer.path);
1594
- const realRoot = fs.realpathSync(path.resolve(deps.hqRoot));
1608
+ const realRoot = fs.realpathSync.native(path.resolve(deps.hqRoot));
1595
1609
  const placeholderRel = toPosix(path.relative(realRoot, placeholder));
1596
1610
  if (`${toPosix(path.relative(realRoot, target))}${PLACEHOLDER_SUFFIX}` !== placeholderRel) {
1597
1611
  throw new Error(`Placeholder '${placeholderRel}' names '${pointer.path}', which is not its own location. Nothing was changed.`);
@@ -845,7 +845,8 @@ const CURRENT_ACTION_LABEL = {
845
845
  /** One `--current` plan line: path, size, owning vault, sync state, action. */
846
846
  function formatCurrentFile(f) {
847
847
  const vault = f.vault === "company" ? `company ${f.company ?? "?"}` : "personal vault";
848
- const parts = [f.path, formatBytes(f.bytes), vault, f.synced ? "synced" : "not synced", CURRENT_ACTION_LABEL[f.action]];
848
+ const syncState = f.excluded_by === "server-owned" ? "sync not checked" : f.synced ? "synced" : "not synced";
849
+ const parts = [f.path, formatBytes(f.bytes), vault, syncState, CURRENT_ACTION_LABEL[f.action]];
849
850
  if (f.action === "upload+offload") {
850
851
  parts.push(`(${f.bytes} bytes to the company ${f.company ?? "?"} vault at ${f.vault_key ?? f.path})`);
851
852
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indigoai-us/hq-cli",
3
- "version": "5.345.207",
3
+ "version": "5.345.208",
4
4
  "description": "HQ by Indigo management CLI — modules and cloud sync",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -117,11 +117,11 @@
117
117
  "*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}": "eslint --cache --no-error-on-unmatched-pattern"
118
118
  },
119
119
  "optionalDependencies": {
120
- "@indigoai-us/hq-hook-win32-x64": "5.345.207",
121
- "@indigoai-us/hq-hook-win32-arm64": "5.345.207",
122
- "@indigoai-us/hq-hook-darwin-x64": "5.345.207",
123
- "@indigoai-us/hq-hook-darwin-arm64": "5.345.207",
124
- "@indigoai-us/hq-hook-linux-x64": "5.345.207",
125
- "@indigoai-us/hq-hook-linux-arm64": "5.345.207"
120
+ "@indigoai-us/hq-hook-win32-x64": "5.345.208",
121
+ "@indigoai-us/hq-hook-win32-arm64": "5.345.208",
122
+ "@indigoai-us/hq-hook-darwin-x64": "5.345.208",
123
+ "@indigoai-us/hq-hook-darwin-arm64": "5.345.208",
124
+ "@indigoai-us/hq-hook-linux-x64": "5.345.208",
125
+ "@indigoai-us/hq-hook-linux-arm64": "5.345.208"
126
126
  }
127
127
  }