@indigoai-us/hq-cli 5.345.62 → 5.345.64

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.
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Work Mesh Live — network-safe work location derived from the local cwd.
3
+ *
4
+ * `cwd` is a local-only spool field and never leaves the machine. Before an
5
+ * event is sent, the flush derives three short labels from it:
6
+ * - repo: basename of `git rev-parse --show-toplevel` (omitted outside git)
7
+ * - gitBranch: `git rev-parse --abbrev-ref HEAD` (omitted on detached HEAD)
8
+ * - folder: basename of the cwd, never a path (no "/" or "\")
9
+ * Git lookups are cached per cwd for one flush, bounded by a short timeout,
10
+ * and never throw; on failure the fields are omitted.
11
+ */
12
+ import { collectGitContext } from "./report-summary.js";
13
+ const MAX_LABEL = 128;
14
+ /** Last path segment of `cwd` (POSIX or Windows separators), or undefined. */
15
+ export function folderFromCwd(cwd) {
16
+ const segments = cwd.split(/[/\\]+/).filter((s) => s.length > 0);
17
+ const last = segments[segments.length - 1];
18
+ if (!last || last.length > MAX_LABEL || last.includes("\0"))
19
+ return undefined;
20
+ // Bare drive roots ("C:") are not a useful folder label.
21
+ if (/^[A-Za-z]:$/.test(last))
22
+ return undefined;
23
+ return last;
24
+ }
25
+ function safeLabel(value) {
26
+ if (!value || value.length > MAX_LABEL || value.includes("\0"))
27
+ return undefined;
28
+ return value;
29
+ }
30
+ /** Resolve the work location for one cwd. Never throws. */
31
+ export function resolveWorkLocation(cwd, git) {
32
+ const out = {};
33
+ try {
34
+ const folder = folderFromCwd(cwd);
35
+ if (folder)
36
+ out.folder = folder;
37
+ const ctx = collectGitContext(cwd, git);
38
+ const repo = safeLabel(ctx.repo);
39
+ if (repo && !/[/\\]/.test(repo))
40
+ out.repo = repo;
41
+ const branch = safeLabel(ctx.gitBranch);
42
+ if (branch)
43
+ out.gitBranch = branch;
44
+ }
45
+ catch {
46
+ /* omit on failure */
47
+ }
48
+ return out;
49
+ }
50
+ /** A resolver that caches results per cwd (create one per flush). */
51
+ export function createWorkLocationResolver(git) {
52
+ const cache = new Map();
53
+ return (cwd) => {
54
+ const hit = cache.get(cwd);
55
+ if (hit)
56
+ return hit;
57
+ const loc = resolveWorkLocation(cwd, git);
58
+ cache.set(cwd, loc);
59
+ return loc;
60
+ };
61
+ }
62
+ /**
63
+ * Copy of `event` with repo / gitBranch / folder filled from its local cwd.
64
+ * Values already on the event win. Call before stripLocalOnlyFields.
65
+ */
66
+ export function withWorkLocation(event, resolve) {
67
+ const cwd = typeof event.cwd === "string" ? event.cwd.trim() : "";
68
+ if (!cwd)
69
+ return event;
70
+ let loc;
71
+ try {
72
+ loc = resolve(cwd);
73
+ }
74
+ catch {
75
+ return event;
76
+ }
77
+ const out = { ...event };
78
+ if (!out.repo && loc.repo)
79
+ out.repo = loc.repo;
80
+ if (!out.gitBranch && loc.gitBranch)
81
+ out.gitBranch = loc.gitBranch;
82
+ if (!out.folder && loc.folder)
83
+ out.folder = loc.folder;
84
+ return out;
85
+ }
86
+ //# sourceMappingURL=work-location.js.map
@@ -1947,7 +1947,11 @@ export async function enforceVersionGate(onUpdateRecommended, options = {}) {
1947
1947
  * force-upgraded.
1948
1948
  */
1949
1949
  export function shouldSkipGate(argv) {
1950
- return isVersionRequest(argv) || argv.some((a) => a === "--version" ||
1950
+ // Hook-time deliveries must finish inside the provider's timeout budget.
1951
+ // process.argv slots 0 and 1 are the runtime and CLI entry point. Inspect
1952
+ // command positions only; user arguments may legitimately contain these words.
1953
+ const hookTimeLinkDelivery = argv[2] === "lanes" && argv[3] === "link" && argv[4] === "_deliver";
1954
+ return hookTimeLinkDelivery || isVersionRequest(argv) || argv.some((a) => a === "--version" ||
1951
1955
  a === "-V" ||
1952
1956
  a === "-v" ||
1953
1957
  a === "--help" ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indigoai-us/hq-cli",
3
- "version": "5.345.62",
3
+ "version": "5.345.64",
4
4
  "description": "HQ by Indigo management CLI — modules and cloud sync",
5
5
  "main": "dist/index.js",
6
6
  "bin": {