@indigoai-us/hq-cli 5.311.4 → 5.312.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.
Files changed (96) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/assets/scaffold/core/scripts/lib/work-mesh-live-hook.sh +378 -0
  3. package/assets/scaffold/core/scripts/lib/work-mesh-live-rebind.sh +141 -0
  4. package/assets/scaffold/core/scripts/migrate-policy-triggers.sh +373 -0
  5. package/assets/scaffold/core/scripts/register-project.sh +262 -0
  6. package/assets/scaffold/core/scripts/work-mesh-live-rebind.sh +59 -0
  7. package/dist/command-catalog.generated.d.ts +160 -0
  8. package/dist/command-catalog.generated.js +200 -0
  9. package/dist/command-registration-plan.d.ts +6 -0
  10. package/dist/command-registration-plan.js +1 -0
  11. package/dist/commands/company-rename-flag.d.ts +4 -0
  12. package/dist/commands/company-rename-flag.js +7 -0
  13. package/dist/commands/company-rename.d.ts +4 -0
  14. package/dist/commands/company-rename.js +90 -0
  15. package/dist/commands/company.js +2 -0
  16. package/dist/commands/core-checkpoint-stop-gate-native.js +12 -0
  17. package/dist/commands/core-eval-trigger-native.d.ts +4 -0
  18. package/dist/commands/core-eval-trigger-native.js +12 -0
  19. package/dist/commands/core-migrate-policy-triggers-native.d.ts +21 -0
  20. package/dist/commands/core-migrate-policy-triggers-native.js +378 -0
  21. package/dist/commands/core-native-hook-helper-commands.d.ts +4 -0
  22. package/dist/commands/core-native-hook-helper-commands.js +56 -0
  23. package/dist/commands/core-native-hook-helpers-flag.d.ts +4 -0
  24. package/dist/commands/core-native-hook-helpers-flag.js +7 -0
  25. package/dist/commands/core-register-project-native.d.ts +30 -0
  26. package/dist/commands/core-register-project-native.js +347 -0
  27. package/dist/commands/core-work-mesh-live-rebind-native.d.ts +18 -0
  28. package/dist/commands/core-work-mesh-live-rebind-native.js +262 -0
  29. package/dist/commands/core.js +7 -0
  30. package/dist/commands/daemon.js +22 -0
  31. package/dist/commands/dm.js +22 -6
  32. package/dist/commands/files-browse.js +16 -4
  33. package/dist/commands/lanes-message.js +17 -2
  34. package/dist/commands/lanes-shared.d.ts +1 -0
  35. package/dist/commands/lanes.js +96 -20
  36. package/dist/commands/vault-retention-flag.d.ts +3 -0
  37. package/dist/commands/vault-retention-flag.js +9 -0
  38. package/dist/commands/vault-retention.d.ts +11 -0
  39. package/dist/commands/vault-retention.js +69 -0
  40. package/dist/fast-core.js +10 -3
  41. package/dist/fast-scaffold.d.ts +2 -0
  42. package/dist/fast-scaffold.js +11 -0
  43. package/dist/lib/agents/model-catalog.d.ts +3 -2
  44. package/dist/lib/company-skill-wrapper.d.ts +0 -8
  45. package/dist/lib/core-utils/codex-skill-bridge.d.ts +2 -1
  46. package/dist/lib/core-utils/sentry-report.js +21 -4
  47. package/dist/lib/daemon/catalog.d.ts +2 -0
  48. package/dist/lib/daemon/catalog.js +13 -1
  49. package/dist/lib/daemon/config.d.ts +2 -0
  50. package/dist/lib/daemon/config.js +4 -0
  51. package/dist/lib/daemon/run.d.ts +2 -0
  52. package/dist/lib/daemon/run.js +5 -0
  53. package/dist/lib/deploy-api.d.ts +0 -1
  54. package/dist/lib/deploy-api.js +1 -1
  55. package/dist/lib/doctor/checks/work-context.js +9 -1
  56. package/dist/lib/lanes/autopilot.d.ts +38 -1
  57. package/dist/lib/lanes/autopilot.js +353 -5
  58. package/dist/lib/lanes/flag-keys.d.ts +9 -1
  59. package/dist/lib/lanes/flag-keys.js +9 -1
  60. package/dist/lib/lanes/keep-alive.d.ts +2 -0
  61. package/dist/lib/lanes/keep-alive.js +2 -0
  62. package/dist/lib/lanes/reconcile.d.ts +5 -0
  63. package/dist/lib/lanes/reconcile.js +57 -4
  64. package/dist/lib/lanes/watcher-main.js +20 -1
  65. package/dist/lib/lanes/watcher.d.ts +9 -0
  66. package/dist/lib/lanes/watcher.js +47 -1
  67. package/dist/lib/mesh/client.js +23 -5
  68. package/dist/lib/mesh/denial-codes.d.ts +5 -0
  69. package/dist/lib/mesh/denial-codes.js +14 -0
  70. package/dist/lib/mesh/live/daemon/doctor.d.ts +2 -0
  71. package/dist/lib/mesh/live/daemon/doctor.js +11 -1
  72. package/dist/lib/report-run.d.ts +3 -2
  73. package/dist/lib/report-templates.d.ts +0 -1
  74. package/dist/lib/report-templates.js +0 -3
  75. package/dist/lib/scaffold-cli-floor.d.ts +0 -1
  76. package/dist/lib/scaffold-cli-floor.js +1 -1
  77. package/dist/lib/search-index/embed-lock.d.ts +2 -0
  78. package/dist/lib/search-index/embed-lock.js +10 -1
  79. package/dist/lib/work-context/contract.d.ts +3 -0
  80. package/dist/lib/work-context/contract.schema.json +3 -1
  81. package/dist/lib/work-context/outbox.d.ts +14 -5
  82. package/dist/lib/work-context/outbox.js +48 -5
  83. package/dist/lib/work-context/reconcile.js +26 -5
  84. package/dist/main.d.ts +20 -0
  85. package/dist/main.js +8 -1
  86. package/dist/run/discover-schemas.d.ts +2 -1
  87. package/dist/utils/core-eval-trigger.d.ts +4 -0
  88. package/dist/utils/core-eval-trigger.js +88 -0
  89. package/dist/utils/hq-roots.d.ts +0 -2
  90. package/dist/utils/hq-roots.js +1 -8
  91. package/dist/utils/incomplete-install-error.d.ts +7 -6
  92. package/dist/utils/large-file-guard.d.ts +0 -10
  93. package/dist/utils/large-file-guard.js +1 -1
  94. package/dist/utils/package-root-diagnostics.d.ts +1 -1
  95. package/dist/utils/self-update.d.ts +2 -1
  96. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -108,6 +108,13 @@ class ForegroundNetworkBudget {
108
108
  }
109
109
  }
110
110
  }
111
+ /** Create a shared invocation budget; exported so the time accounting is directly testable. */
112
+ export function createForegroundNetworkBudget(options = {}) {
113
+ if (options.budgetMs === undefined && options.now === undefined) {
114
+ return new ForegroundNetworkBudget();
115
+ }
116
+ return new ForegroundNetworkBudget(options.budgetMs ?? FOREGROUND_NETWORK_BUDGET_MS, options.now ?? (() => performance.now()));
117
+ }
111
118
  let activeForegroundNetworkBudget;
112
119
  /**
113
120
  * The RUNNING install's own entrypoint (`<pkg>/dist/index.js`), used as the
@@ -193,7 +200,7 @@ program.hook("preAction", async () => {
193
200
  });
194
201
  });
195
202
  export async function runCli() {
196
- const foregroundNetworkBudget = new ForegroundNetworkBudget();
203
+ const foregroundNetworkBudget = createForegroundNetworkBudget();
197
204
  activeForegroundNetworkBudget = foregroundNetworkBudget;
198
205
  // Login must be usable before any identity or company is available, so do
199
206
  // not make a pre-auth feature-flag request on this path. Other commands
@@ -1,4 +1,4 @@
1
- export interface SchemaConflict {
1
+ interface SchemaConflict {
2
2
  paths: [string, string];
3
3
  slugs: [string, string];
4
4
  }
@@ -9,4 +9,5 @@ export interface DiscoverSchemasResult {
9
9
  conflict: SchemaConflict | null;
10
10
  }
11
11
  export declare function discoverSchemas(cwd: string): DiscoverSchemasResult;
12
+ export {};
12
13
  //# sourceMappingURL=discover-schemas.d.ts.map
@@ -0,0 +1,4 @@
1
+ /** Return shell-compatible 0/1/2: true, false, or malformed. */
2
+ export declare function evaluateTrigger(expr: string, facts?: string): number;
3
+ export declare function checkTriggerExpressions(stdin: string): string;
4
+ //# sourceMappingURL=core-eval-trigger.d.ts.map
@@ -0,0 +1,88 @@
1
+ /** Pure evaluator shared by the native command and migration helper. */
2
+ function parseBooleanExpression(input) {
3
+ const expression = input;
4
+ if (/[^01&|!() \t]/.test(expression))
5
+ return { valid: false, value: false };
6
+ let position = 0;
7
+ let valid = true;
8
+ const skip = () => { while (expression[position] === " " || expression[position] === "\t")
9
+ position += 1; };
10
+ const atom = () => {
11
+ skip();
12
+ const char = expression[position];
13
+ if (char === "(") {
14
+ position += 1;
15
+ const value = parseOr();
16
+ skip();
17
+ if (expression[position] !== ")") {
18
+ valid = false;
19
+ return false;
20
+ }
21
+ position += 1;
22
+ return value;
23
+ }
24
+ if (char === "0" || char === "1") {
25
+ position += 1;
26
+ return char === "1";
27
+ }
28
+ valid = false;
29
+ return false;
30
+ };
31
+ const parseNot = () => {
32
+ skip();
33
+ if (expression[position] === "!") {
34
+ position += 1;
35
+ return !parseNot();
36
+ }
37
+ return atom();
38
+ };
39
+ const parseAnd = () => {
40
+ let value = parseNot();
41
+ skip();
42
+ while (valid && expression.slice(position, position + 2) === "&&") {
43
+ position += 2;
44
+ const rhs = parseNot();
45
+ value = value && rhs;
46
+ skip();
47
+ }
48
+ return value;
49
+ };
50
+ function parseOr() {
51
+ let value = parseAnd();
52
+ skip();
53
+ while (valid && expression.slice(position, position + 2) === "||") {
54
+ position += 2;
55
+ const rhs = parseAnd();
56
+ value = value || rhs;
57
+ skip();
58
+ }
59
+ return value;
60
+ }
61
+ const value = parseOr();
62
+ skip();
63
+ return { valid: valid && position === expression.length, value };
64
+ }
65
+ /** Return shell-compatible 0/1/2: true, false, or malformed. */
66
+ export function evaluateTrigger(expr, facts = "") {
67
+ if (expr.replace(/[ \t]/g, "") === "")
68
+ return 2;
69
+ const have = new Set(facts.split(/[ ,]+/).filter(Boolean));
70
+ const substituted = expr.replace(/[A-Za-z0-9_./][A-Za-z0-9_./-]*/g, (token) => have.has(token.toLowerCase()) ? "1" : "0");
71
+ if (/[^01&|!() \t]/.test(substituted))
72
+ return 2;
73
+ const parsed = parseBooleanExpression(substituted);
74
+ if (!parsed.valid)
75
+ return 2;
76
+ return parsed.value ? 0 : 1;
77
+ }
78
+ export function checkTriggerExpressions(stdin) {
79
+ if (!stdin)
80
+ return "";
81
+ return stdin.split("\n").filter((line, index, all) => index < all.length - 1 || line !== "").map((line) => {
82
+ const tab = line.indexOf("\t");
83
+ const id = tab < 0 ? line : line.slice(0, tab);
84
+ const expr = tab < 0 ? "" : line.slice(tab + 1);
85
+ return `${id}\t${evaluateTrigger(expr, "") === 2 ? "malformed" : "ok"}\n`;
86
+ }).join("");
87
+ }
88
+ //# sourceMappingURL=core-eval-trigger.js.map
@@ -59,8 +59,6 @@ export declare function createPackageRootResolver(options: PackageRootResolverOp
59
59
  * answer survives a change in output layout.
60
60
  */
61
61
  export declare function packageRoot(): string;
62
- /** Reset the memoized package root. Tests only. */
63
- export declare function __resetPackageRootCache(): void;
64
62
  /**
65
63
  * Derive this package's installed root from the running module's OWN path using
66
64
  * STRING operations only — no `readFileSync`, `realpathSync`, or `existsSync`.
@@ -170,7 +170,7 @@ export function createPackageRootResolver(options) {
170
170
  };
171
171
  }
172
172
  const currentModulePath = fileURLToPath(import.meta.url);
173
- let defaultPackageRootResolver = createPackageRootResolver({
173
+ const defaultPackageRootResolver = createPackageRootResolver({
174
174
  moduleDir: path.dirname(currentModulePath),
175
175
  modulePath: currentModulePath,
176
176
  });
@@ -184,13 +184,6 @@ let defaultPackageRootResolver = createPackageRootResolver({
184
184
  export function packageRoot() {
185
185
  return defaultPackageRootResolver();
186
186
  }
187
- /** Reset the memoized package root. Tests only. */
188
- export function __resetPackageRootCache() {
189
- defaultPackageRootResolver = createPackageRootResolver({
190
- moduleDir: path.dirname(currentModulePath),
191
- modulePath: currentModulePath,
192
- });
193
- }
194
187
  /**
195
188
  * The trailing path segments that mark an installed copy of this package:
196
189
  * `node_modules` followed by the package name's own segments (for
@@ -11,7 +11,7 @@ export declare const INCOMPLETE_INSTALL_REMEDY: string;
11
11
  /** A resolver for the running install's root; returns null instead of throwing. */
12
12
  export type PackageRootResolver = () => string | null;
13
13
  /** Which strategy produced the running install's root, recorded in diagnostics. */
14
- export type PackageRootResolverSource = "manifest-walk" | "string-derivation" | "unresolved" | "injected";
14
+ type PackageRootResolverSource = "manifest-walk" | "string-derivation" | "unresolved" | "injected";
15
15
  /**
16
16
  * If `err` is an in-process incomplete-install module-load failure — the CJS
17
17
  * relative-sibling shape (HQ-CLI-1N), the ESM vanished-at-read shape (HQ-CLI-1M),
@@ -30,7 +30,7 @@ export declare function incompleteInstallMessage(err: unknown, resolvePackageRoo
30
30
  * whose `path` did not survive delivery — the esm-loader open shape (HQ-CLI-1M) or
31
31
  * the resolve-time lstat shape (HQ-CLI-1S). The two frame booleans say which.
32
32
  */
33
- export type IncompleteInstallEsmDiagnostics = {
33
+ type IncompleteInstallEsmDiagnostics = {
34
34
  /** The resolved install root, or the literal `<unresolved>` when none was found. */
35
35
  packageRoot: string;
36
36
  /** True only when a root was actually resolved (by any strategy). */
@@ -62,7 +62,7 @@ export type IncompleteInstallEsmDiagnostics = {
62
62
  * the closed error name and the bounded package name are recorded; never the
63
63
  * message, argv, or a full path.
64
64
  */
65
- export type IncompleteInstallEvalThrowDiagnostics = {
65
+ type IncompleteInstallEvalThrowDiagnostics = {
66
66
  evalThrow: true;
67
67
  errorName: string;
68
68
  throwSitePackage: string;
@@ -77,13 +77,13 @@ export type IncompleteInstallEvalThrowDiagnostics = {
77
77
  * the requirer's own manifest did NOT declare it. Both names live inside
78
78
  * hq-cli's dependency graph, so grouping cardinality stays bounded.
79
79
  */
80
- export type IncompleteInstallBareDiagnostics = {
80
+ type IncompleteInstallBareDiagnostics = {
81
81
  missingPackage: string;
82
82
  requiringPackage: string;
83
83
  requirerDeclaresMissing: false;
84
84
  };
85
85
  /** The four lexical scopes a NOT-suppressed CJS relative requirer can fall into. */
86
- export type RelativeRequirerScope = "dist" | "assets" | "outside-root" | "unresolved-root";
86
+ type RelativeRequirerScope = "dist" | "assets" | "outside-root" | "unresolved-root";
87
87
  /**
88
88
  * Bounded, scrubber-safe diagnostics for a NOT-suppressed CJS RELATIVE-specifier
89
89
  * miss (HQ-CLI-1N): the CJS relative-sibling shape that reached the capture path
@@ -93,7 +93,7 @@ export type RelativeRequirerScope = "dist" | "assets" | "outside-root" | "unreso
93
93
  * against the root — never the requirer path and never the specifier — so
94
94
  * grouping cardinality cannot inflate. `code` is always `MODULE_NOT_FOUND`.
95
95
  */
96
- export type IncompleteInstallRelativeDiagnostics = {
96
+ type IncompleteInstallRelativeDiagnostics = {
97
97
  code: string;
98
98
  relativeSpecifier: true;
99
99
  packageRoot: string;
@@ -136,4 +136,5 @@ export type IncompleteInstallDiagnostics = Partial<IncompleteInstallEsmDiagnosti
136
136
  export declare function incompleteInstallCaptureContext(err: unknown, resolvePackageRoot?: PackageRootResolver, fileSystem?: Pick<typeof fs, "existsSync"> & Partial<Pick<typeof fs, "readFileSync">>): {
137
137
  incomplete_install: IncompleteInstallDiagnostics;
138
138
  } | undefined;
139
+ export {};
139
140
  //# sourceMappingURL=incomplete-install-error.d.ts.map
@@ -18,16 +18,6 @@ export interface LargeFileGuardOptions {
18
18
  /** Bypass the throttle. */
19
19
  force?: boolean;
20
20
  }
21
- /**
22
- * Render a repo-relative path as a literal `.gitignore` pattern.
23
- *
24
- * The leading slash anchors it to the repo root — without it a bare filename
25
- * would also ignore same-named files in every subdirectory. Glob and
26
- * character-class metacharacters are escaped so the rule matches the one real
27
- * path and nothing else, and a trailing space is escaped because git strips
28
- * unescaped ones.
29
- */
30
- export declare function toGitignorePattern(relPath: string): string;
31
21
  /**
32
22
  * Scan `hqRoot` for files above the size limit, ignore them, and drop any that
33
23
  * are already in the index.
@@ -177,7 +177,7 @@ function oversizedInWorktree(hqRoot, threshold) {
177
177
  * path and nothing else, and a trailing space is escaped because git strips
178
178
  * unescaped ones.
179
179
  */
180
- export function toGitignorePattern(relPath) {
180
+ function toGitignorePattern(relPath) {
181
181
  const escaped = relPath.replace(/([\\*?[\]!#])/g, "\\$1");
182
182
  const anchored = `/${escaped}`;
183
183
  return anchored.endsWith(" ") ? `${anchored.slice(0, -1)}\\ ` : anchored;
@@ -6,7 +6,7 @@
6
6
  * so a malformed install cannot turn an error report into an unbounded or
7
7
  * multi-line payload.
8
8
  */
9
- export type PackageRootVisitOutcome = "no-manifest" | "eacces" | "eisdir" | "parse-error" | "name-mismatch" | "read-error" | "omitted";
9
+ type PackageRootVisitOutcome = "no-manifest" | "eacces" | "eisdir" | "parse-error" | "name-mismatch" | "read-error" | "omitted";
10
10
  export type PackageRootVisit = {
11
11
  directory: string;
12
12
  outcome: PackageRootVisitOutcome;
@@ -64,7 +64,7 @@ import { type RestartDaemonResult } from "../lib/mesh/live/daemon/install.js";
64
64
  * One update + one re-exec per user invocation, ever.
65
65
  */
66
66
  export declare const REEXEC_GUARD_ENV = "HQ_RESCUE_SELF_UPDATED";
67
- export type SelfUpdateAction =
67
+ type SelfUpdateAction =
68
68
  /** Opted out, guard set, lock held elsewhere, or latest unknown — nothing attempted. */
69
69
  "skipped"
70
70
  /** Already at (or ahead of) npm latest. */
@@ -200,4 +200,5 @@ export declare function selfUpdateAndReexec(argv: readonly string[], deps?: Self
200
200
  * outcome the daemon restarts itself onto the new version.
201
201
  */
202
202
  export declare function daemonSelfUpdate(deps?: SelfUpdateDeps): Promise<SelfUpdateOutcome>;
203
+ export {};
203
204
  //# sourceMappingURL=self-update.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indigoai-us/hq-cli",
3
- "version": "5.311.4",
3
+ "version": "5.312.1",
4
4
  "description": "HQ by Indigo management CLI — modules and cloud sync",
5
5
  "main": "dist/index.js",
6
6
  "bin": {