@indigoai-us/hq-cloud 6.13.5 → 6.14.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.
@@ -37,10 +37,48 @@ export function buildTargetedPushArgv(
37
37
  return ["--companies", "--direction", "push", ...carried];
38
38
  }
39
39
 
40
+ export function buildScopedPushArgv(
41
+ route: WatchRoute,
42
+ relPaths: readonly string[],
43
+ baseArgv: string[],
44
+ ): string[] {
45
+ const scopeArgs = scopedPathArgs(route, relPaths);
46
+ const carried = carriedFlags(baseArgv);
47
+ if (route.kind === "company") {
48
+ return [
49
+ "--company",
50
+ route.slug,
51
+ "--direction",
52
+ "push",
53
+ ...scopeArgs,
54
+ ...carried,
55
+ ];
56
+ }
57
+ return ["--personal", "--direction", "push", ...scopeArgs, ...carried];
58
+ }
59
+
40
60
  export function buildFullFanoutPushArgv(baseArgv: string[]): string[] {
41
61
  return ["--companies", "--direction", "push", ...carriedFlags(baseArgv)];
42
62
  }
43
63
 
64
+ export function buildScopedDrainPullArgv(baseArgv: string[]): string[] {
65
+ const carried = carriedFlags(baseArgv);
66
+ if (baseArgv.includes("--personal")) {
67
+ return ["--personal", "--direction", "pull", ...carried];
68
+ }
69
+ const companyIdx = baseArgv.indexOf("--company");
70
+ if (companyIdx >= 0 && baseArgv[companyIdx + 1] !== undefined) {
71
+ return [
72
+ "--company",
73
+ baseArgv[companyIdx + 1],
74
+ "--direction",
75
+ "pull",
76
+ ...carried,
77
+ ];
78
+ }
79
+ return ["--companies", "--direction", "pull", ...carried];
80
+ }
81
+
44
82
  /**
45
83
  * Build the argv for a targeted pull pass from a routed change.
46
84
  */
@@ -55,7 +93,7 @@ export function buildTargetedPullArgv(
55
93
  return ["--companies", "--direction", "pull", ...carried];
56
94
  }
57
95
 
58
- function routeKey(route: WatchRoute): string {
96
+ export function routeKey(route: WatchRoute): string {
59
97
  return route.kind === "company" ? `company:${route.slug}` : "personal";
60
98
  }
61
99
 
@@ -69,6 +107,24 @@ export function routesForBatch(batch: TreeChangeBatch): Map<string, WatchRoute>
69
107
  return routes;
70
108
  }
71
109
 
110
+ function scopedPathArgs(route: WatchRoute, relPaths: readonly string[]): string[] {
111
+ const args: string[] = [];
112
+ for (const relPath of relPaths) {
113
+ const scopePath = scopePathForRoute(route, relPath);
114
+ if (scopePath === null) continue;
115
+ args.push("--scope-path", scopePath);
116
+ }
117
+ return args;
118
+ }
119
+
120
+ function scopePathForRoute(route: WatchRoute, relPath: string): string | null {
121
+ const norm = relPath.split(path.sep).join("/").replace(/^\.\//, "");
122
+ if (route.kind === "personal") return norm;
123
+ const prefix = `companies/${route.slug}/`;
124
+ if (norm.startsWith(prefix)) return norm.slice(prefix.length);
125
+ return null;
126
+ }
127
+
72
128
  /**
73
129
  * Extract the `--hq-root` / `--on-conflict` pair-flags from a base argv so a
74
130
  * re-targeted pass inherits the same root and conflict policy.