@indigoai-us/hq-cli 5.312.0 → 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.
- package/CHANGELOG.md +7 -0
- package/assets/scaffold/core/scripts/lib/work-mesh-live-hook.sh +378 -0
- package/assets/scaffold/core/scripts/lib/work-mesh-live-rebind.sh +141 -0
- package/assets/scaffold/core/scripts/migrate-policy-triggers.sh +373 -0
- package/assets/scaffold/core/scripts/register-project.sh +262 -0
- package/assets/scaffold/core/scripts/work-mesh-live-rebind.sh +59 -0
- package/dist/command-catalog.generated.d.ts +65 -0
- package/dist/command-catalog.generated.js +80 -0
- package/dist/commands/company-rename-flag.d.ts +4 -0
- package/dist/commands/company-rename-flag.js +7 -0
- package/dist/commands/company-rename.d.ts +4 -0
- package/dist/commands/company-rename.js +90 -0
- package/dist/commands/company.js +2 -0
- package/dist/commands/core-checkpoint-stop-gate-native.js +12 -0
- package/dist/commands/core-eval-trigger-native.d.ts +4 -0
- package/dist/commands/core-eval-trigger-native.js +12 -0
- package/dist/commands/core-migrate-policy-triggers-native.d.ts +21 -0
- package/dist/commands/core-migrate-policy-triggers-native.js +378 -0
- package/dist/commands/core-native-hook-helper-commands.d.ts +4 -0
- package/dist/commands/core-native-hook-helper-commands.js +56 -0
- package/dist/commands/core-native-hook-helpers-flag.d.ts +4 -0
- package/dist/commands/core-native-hook-helpers-flag.js +7 -0
- package/dist/commands/core-register-project-native.d.ts +30 -0
- package/dist/commands/core-register-project-native.js +347 -0
- package/dist/commands/core-work-mesh-live-rebind-native.d.ts +18 -0
- package/dist/commands/core-work-mesh-live-rebind-native.js +262 -0
- package/dist/commands/core.js +7 -0
- package/dist/fast-core.js +10 -3
- package/dist/fast-scaffold.d.ts +2 -0
- package/dist/fast-scaffold.js +11 -0
- package/dist/lib/agents/model-catalog.d.ts +3 -2
- package/dist/lib/company-skill-wrapper.d.ts +0 -8
- package/dist/lib/core-utils/codex-skill-bridge.d.ts +2 -1
- package/dist/lib/deploy-api.d.ts +0 -1
- package/dist/lib/deploy-api.js +1 -1
- package/dist/lib/doctor/checks/work-context.js +9 -1
- package/dist/lib/mesh/client.js +23 -5
- package/dist/lib/mesh/denial-codes.d.ts +5 -0
- package/dist/lib/mesh/denial-codes.js +14 -0
- package/dist/lib/mesh/live/daemon/doctor.d.ts +2 -0
- package/dist/lib/mesh/live/daemon/doctor.js +11 -1
- package/dist/lib/report-run.d.ts +3 -2
- package/dist/lib/report-templates.d.ts +0 -1
- package/dist/lib/report-templates.js +0 -3
- package/dist/lib/scaffold-cli-floor.d.ts +0 -1
- package/dist/lib/scaffold-cli-floor.js +1 -1
- package/dist/lib/search-index/embed-lock.d.ts +2 -0
- package/dist/lib/search-index/embed-lock.js +10 -1
- package/dist/lib/work-context/contract.d.ts +3 -0
- package/dist/lib/work-context/contract.schema.json +3 -1
- package/dist/lib/work-context/outbox.d.ts +14 -5
- package/dist/lib/work-context/outbox.js +48 -5
- package/dist/lib/work-context/reconcile.js +26 -5
- package/dist/main.d.ts +20 -0
- package/dist/main.js +8 -1
- package/dist/run/discover-schemas.d.ts +2 -1
- package/dist/utils/core-eval-trigger.d.ts +4 -0
- package/dist/utils/core-eval-trigger.js +88 -0
- package/dist/utils/hq-roots.d.ts +0 -2
- package/dist/utils/hq-roots.js +1 -8
- package/dist/utils/incomplete-install-error.d.ts +7 -6
- package/dist/utils/large-file-guard.d.ts +0 -10
- package/dist/utils/large-file-guard.js +1 -1
- package/dist/utils/package-root-diagnostics.d.ts +1 -1
- package/dist/utils/self-update.d.ts +2 -1
- package/package.json +1 -1
package/dist/main.d.ts
CHANGED
|
@@ -12,6 +12,25 @@ import { upgradeToTeam } from "./utils/team-upgrade.js";
|
|
|
12
12
|
* finalization; command execution itself does not consume this allowance.
|
|
13
13
|
*/
|
|
14
14
|
export declare const FOREGROUND_NETWORK_BUDGET_MS = 1500;
|
|
15
|
+
/**
|
|
16
|
+
* Shared accounting for awaited foreground network work. Each lifecycle phase
|
|
17
|
+
* debits only the bounded await it performs; ordinary command runtime leaves
|
|
18
|
+
* the allowance untouched. Earlier phases reserve the finalization floor, so
|
|
19
|
+
* error flushing cannot disappear after a long command.
|
|
20
|
+
*/
|
|
21
|
+
declare class ForegroundNetworkBudget {
|
|
22
|
+
private readonly budgetMs;
|
|
23
|
+
private readonly now;
|
|
24
|
+
private consumedMs;
|
|
25
|
+
constructor(budgetMs?: number, now?: () => number);
|
|
26
|
+
timeoutFor(phaseMaximumMs: number, reservedMs?: number): number;
|
|
27
|
+
waitFor<T>(phaseMaximumMs: number, reservedMs: number, work: (timeoutMs: number) => Promise<T>): Promise<T | undefined>;
|
|
28
|
+
}
|
|
29
|
+
/** Create a shared invocation budget; exported so the time accounting is directly testable. */
|
|
30
|
+
export declare function createForegroundNetworkBudget(options?: {
|
|
31
|
+
budgetMs?: number;
|
|
32
|
+
now?: () => number;
|
|
33
|
+
}): ForegroundNetworkBudget;
|
|
15
34
|
export type StreamErrorDependencies = {
|
|
16
35
|
stderr: Pick<typeof process.stderr, "write">;
|
|
17
36
|
exit: (code: number) => void;
|
|
@@ -30,4 +49,5 @@ export type TopLevelErrorDependencies = {
|
|
|
30
49
|
};
|
|
31
50
|
/** Classify a top-level failure without making the CLI process boundary opaque to tests. */
|
|
32
51
|
export declare function handleTopLevelError(err: unknown, deps?: TopLevelErrorDependencies): Promise<void>;
|
|
52
|
+
export {};
|
|
33
53
|
//# sourceMappingURL=main.d.ts.map
|
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 =
|
|
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
|
-
|
|
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,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
|
package/dist/utils/hq-roots.d.ts
CHANGED
|
@@ -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`.
|
package/dist/utils/hq-roots.js
CHANGED
|
@@ -170,7 +170,7 @@ export function createPackageRootResolver(options) {
|
|
|
170
170
|
};
|
|
171
171
|
}
|
|
172
172
|
const currentModulePath = fileURLToPath(import.meta.url);
|
|
173
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|