@indigoai-us/hq-cli 5.273.0-alpha.0 → 5.274.0

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 (91) hide show
  1. package/CHANGELOG.md +65 -2
  2. package/README.md +32 -1
  3. package/dist/command-catalog.generated.d.ts +83 -536
  4. package/dist/command-catalog.generated.js +129 -714
  5. package/dist/command-registration-plan.d.ts +12 -0
  6. package/dist/command-registration-plan.js +2 -0
  7. package/dist/commands/cloud.js +40 -0
  8. package/dist/commands/core-checkpoint.js +3 -1
  9. package/dist/commands/core-command-catalog.d.ts +32 -0
  10. package/dist/commands/core-command-catalog.js +58 -0
  11. package/dist/commands/core-ontology.js +9 -4
  12. package/dist/commands/core.d.ts +4 -0
  13. package/dist/commands/core.js +79 -75
  14. package/dist/commands/daemon.d.ts +0 -3
  15. package/dist/commands/daemon.js +1 -173
  16. package/dist/commands/deploy-comments.d.ts +3 -0
  17. package/dist/commands/deploy-comments.js +159 -0
  18. package/dist/commands/lanes-checks.d.ts +0 -1
  19. package/dist/commands/lanes-checks.js +217 -54
  20. package/dist/commands/lanes-hold.js +40 -2
  21. package/dist/commands/lanes-message.js +98 -14
  22. package/dist/commands/lanes-move.d.ts +12 -0
  23. package/dist/commands/lanes-move.js +342 -0
  24. package/dist/commands/lanes-resume.js +3 -1
  25. package/dist/commands/lanes-shared.d.ts +39 -3
  26. package/dist/commands/lanes-shared.js +59 -0
  27. package/dist/commands/lanes.d.ts +3 -5
  28. package/dist/commands/lanes.js +206 -478
  29. package/dist/commands/report.js +2 -14
  30. package/dist/commands/sync-mode.d.ts +0 -11
  31. package/dist/commands/sync-mode.js +0 -30
  32. package/dist/fast-core.js +1 -1
  33. package/dist/{commands/scaffold-fast.d.ts → fast-scaffold.d.ts} +1 -1
  34. package/dist/{commands/scaffold-fast.js → fast-scaffold.js} +1 -1
  35. package/dist/index.d.ts +1 -1
  36. package/dist/index.js +2 -2
  37. package/dist/lib/checkpoint-ontology/apply.d.ts +8 -0
  38. package/dist/lib/checkpoint-ontology/apply.js +33 -0
  39. package/dist/lib/checkpoint-ontology/plan.d.ts +15 -0
  40. package/dist/lib/checkpoint-ontology/plan.js +15 -0
  41. package/dist/lib/daemon/catalog.d.ts +2 -18
  42. package/dist/lib/daemon/catalog.js +2 -18
  43. package/dist/lib/daemon/config.d.ts +0 -6
  44. package/dist/lib/daemon/config.js +2 -15
  45. package/dist/lib/daemon/requests.d.ts +0 -4
  46. package/dist/lib/daemon/requests.js +0 -2
  47. package/dist/lib/daemon/run.js +19 -78
  48. package/dist/lib/daemon/supervisor.d.ts +0 -8
  49. package/dist/lib/daemon/supervisor.js +1 -101
  50. package/dist/lib/deploy-api.d.ts +6 -0
  51. package/dist/lib/deploy-api.js +21 -0
  52. package/dist/lib/doctor/checks/scaffold-cli-floor.d.ts +7 -0
  53. package/dist/lib/doctor/checks/scaffold-cli-floor.js +73 -0
  54. package/dist/lib/doctor/fix/apply.d.ts +17 -2
  55. package/dist/lib/doctor/fix/apply.js +111 -57
  56. package/dist/lib/doctor/fix/json-output.d.ts +9 -1
  57. package/dist/lib/doctor/fix/json-output.js +11 -0
  58. package/dist/lib/doctor/registry.js +2 -0
  59. package/dist/lib/first-sync-next-step.d.ts +37 -0
  60. package/dist/lib/first-sync-next-step.js +189 -0
  61. package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
  62. package/dist/lib/flag-registry-worker-source.generated.js +1 -1
  63. package/dist/lib/lanes/hire-grant-dispatch.d.ts +6 -1
  64. package/dist/lib/lanes/hire-grant-dispatch.js +78 -3
  65. package/dist/lib/lanes/keep-alive.d.ts +3 -2
  66. package/dist/lib/lanes/keep-alive.js +2 -2
  67. package/dist/lib/lanes/merge-command.d.ts +1 -0
  68. package/dist/lib/lanes/merge-command.js +299 -33
  69. package/dist/lib/lanes/orphans.d.ts +7 -0
  70. package/dist/lib/lanes/orphans.js +39 -4
  71. package/dist/lib/lanes/tracker-store.d.ts +2 -18
  72. package/dist/lib/lanes/tracker-store.js +1 -172
  73. package/dist/lib/scaffold-cli-floor.d.ts +9 -0
  74. package/dist/lib/scaffold-cli-floor.js +50 -0
  75. package/dist/main.js +4 -1
  76. package/dist/utils/cli-telemetry.d.ts +7 -1
  77. package/dist/utils/cli-telemetry.js +84 -8
  78. package/dist/utils/contribution-table.d.ts +1 -1
  79. package/dist/utils/scaffold-fast-import-guard.d.ts +3 -0
  80. package/dist/utils/scaffold-fast-import-guard.js +28 -0
  81. package/dist/utils/scaffold-packlist-guard.d.ts +7 -0
  82. package/dist/utils/scaffold-packlist-guard.js +23 -0
  83. package/dist/utils/scaffold-sibling-references.d.ts +21 -0
  84. package/dist/utils/scaffold-sibling-references.js +156 -0
  85. package/package.json +2 -2
  86. package/dist/commands/lanes-import.d.ts +0 -14
  87. package/dist/commands/lanes-import.js +0 -1210
  88. package/dist/commands/lanes-tracker.d.ts +0 -18
  89. package/dist/commands/lanes-tracker.js +0 -452
  90. package/dist/lib/daemon/sync-runner.d.ts +0 -58
  91. package/dist/lib/daemon/sync-runner.js +0 -277
@@ -0,0 +1,21 @@
1
+ export type SiblingAssetReference = {
2
+ referringAsset: string;
3
+ targetAsset: string;
4
+ };
5
+ export type HqRootAssetReference = {
6
+ referringAsset: string;
7
+ reference: string;
8
+ };
9
+ export type ScaffoldReferenceScan = {
10
+ missing: SiblingAssetReference[];
11
+ allowedHqRoot: HqRootAssetReference[];
12
+ };
13
+ /**
14
+ * Scan every asset below assets/scaffold for local file loads. Node source is
15
+ * identified by extension or shebang; unknown text assets use shell scanning.
16
+ * `${HQ_ROOT}/...` paths stay rooted in the live HQ tree and are returned as
17
+ * allowed references for review instead of being mistaken for package assets.
18
+ */
19
+ export declare function scanScaffoldSiblingReferences(scaffoldRoot: string): ScaffoldReferenceScan;
20
+ export declare function assertNoMissingScaffoldSiblings(scan: ScaffoldReferenceScan): void;
21
+ //# sourceMappingURL=scaffold-sibling-references.d.ts.map
@@ -0,0 +1,156 @@
1
+ import * as fs from "node:fs";
2
+ import * as path from "node:path";
3
+ const SCRIPT_ROOT_TOKENS = /(?:\$\{SCRIPT_DIR\}|\$SCRIPT_DIR)/g;
4
+ const BASH_SOURCE_TOKEN = String.raw `(?:\$\{BASH_SOURCE\[0\](?::-\$0)?\}|\$\{?0\}?)`;
5
+ function relativePath(root, target) {
6
+ return path.relative(root, target).split(path.sep).join("/") || ".";
7
+ }
8
+ function filesBelow(root) {
9
+ const files = [];
10
+ const pending = [root];
11
+ while (pending.length > 0) {
12
+ const current = pending.pop();
13
+ if (!current)
14
+ continue;
15
+ for (const entry of fs.readdirSync(current, { withFileTypes: true })) {
16
+ const fullPath = path.join(current, entry.name);
17
+ if (entry.isDirectory())
18
+ pending.push(fullPath);
19
+ else if (entry.isFile())
20
+ files.push(fullPath);
21
+ }
22
+ }
23
+ return files.sort();
24
+ }
25
+ function shellLocationAliases(contents) {
26
+ // Asset-relative values point into the package. HQ-root values are live-tree
27
+ // paths, so keep them visible as allowed references instead of package deps.
28
+ const aliases = new Map([
29
+ ["SCRIPT_DIR", { kind: "asset", baseDirectory: "." }],
30
+ ["HQ_ROOT", { kind: "hq-root", baseDirectory: "." }],
31
+ ]);
32
+ for (const line of contents.split(/\r?\n/)) {
33
+ const assignment = line.match(/^\s*([A-Za-z_][A-Za-z0-9_]*)=(.*)$/);
34
+ if (!assignment)
35
+ continue;
36
+ const [, name, value] = assignment;
37
+ if (name === "HQ_ROOT" || /\$\{?(?:HQ_ROOT|CLAUDE_PROJECT_DIR)(?:\}|(?=[:/}]))/.test(value)) {
38
+ aliases.set(name, { kind: "hq-root", baseDirectory: "." });
39
+ continue;
40
+ }
41
+ SCRIPT_ROOT_TOKENS.lastIndex = 0;
42
+ const scriptRoot = SCRIPT_ROOT_TOKENS.exec(value);
43
+ if (scriptRoot) {
44
+ const suffix = value.slice(scriptRoot.index + scriptRoot[0].length)
45
+ .match(/^\/([^"'`\s;|&)]+)/)?.[1] ?? ".";
46
+ aliases.set(name, { kind: "asset", baseDirectory: path.posix.normalize(suffix) });
47
+ continue;
48
+ }
49
+ const dirname = new RegExp(String.raw `\$\(\s*dirname\s+["']?${BASH_SOURCE_TOKEN}["']?\s*\)(\/[^"'\x60\s;|&)]+)?`).exec(value);
50
+ if (dirname) {
51
+ const suffix = dirname[1]?.replace(/^\/+/, "") ?? ".";
52
+ aliases.set(name, { kind: "asset", baseDirectory: path.posix.normalize(suffix) });
53
+ }
54
+ }
55
+ return aliases;
56
+ }
57
+ function isNodeAsset(file, contents) {
58
+ if ([".js", ".mjs", ".cjs"].includes(path.extname(file).toLowerCase()))
59
+ return true;
60
+ const shebang = contents.split(/\r?\n/, 1)[0] ?? "";
61
+ return /^#!.*(?:[\s/])node(?:js)?(?:\s|$)/.test(shebang);
62
+ }
63
+ /**
64
+ * Scan every asset below assets/scaffold for local file loads. Node source is
65
+ * identified by extension or shebang; unknown text assets use shell scanning.
66
+ * `${HQ_ROOT}/...` paths stay rooted in the live HQ tree and are returned as
67
+ * allowed references for review instead of being mistaken for package assets.
68
+ */
69
+ export function scanScaffoldSiblingReferences(scaffoldRoot) {
70
+ const root = path.resolve(scaffoldRoot);
71
+ const bundledFiles = filesBelow(root);
72
+ const bundledPaths = new Set(bundledFiles.map((file) => relativePath(root, file)));
73
+ const missing = [];
74
+ const allowedHqRoot = new Map();
75
+ const missingSet = new Set();
76
+ const recordRelative = (sourceFile, specifier, baseDirectory = ".") => {
77
+ const referringAsset = relativePath(root, sourceFile);
78
+ const targetPath = path.resolve(path.dirname(sourceFile), baseDirectory, specifier.replace(/^\/+/, ""));
79
+ const targetAsset = relativePath(root, targetPath);
80
+ if (bundledPaths.has(targetAsset))
81
+ return;
82
+ const key = `${referringAsset}\0${targetAsset}`;
83
+ if (missingSet.has(key))
84
+ return;
85
+ missingSet.add(key);
86
+ missing.push({ referringAsset, targetAsset });
87
+ };
88
+ for (const sourceFile of bundledFiles) {
89
+ const contents = fs.readFileSync(sourceFile, "utf8");
90
+ const referringAsset = relativePath(root, sourceFile);
91
+ for (const line of contents.split(/\r?\n/)) {
92
+ if (/^\s*#/.test(line))
93
+ continue;
94
+ for (const match of line.matchAll(/\$\{HQ_ROOT(?::-[^}]*)?\}\/([^"'`\s;|&)]+)/g)) {
95
+ const reference = "${HQ_ROOT}/" + match[1];
96
+ allowedHqRoot.set(`${referringAsset}\0${reference}`, { referringAsset, reference });
97
+ }
98
+ for (const match of line.matchAll(/\$HQ_ROOT\/([^"'`\s;|&)]+)/g)) {
99
+ const reference = `$HQ_ROOT/${match[1]}`;
100
+ allowedHqRoot.set(`${referringAsset}\0${reference}`, { referringAsset, reference });
101
+ }
102
+ }
103
+ if (isNodeAsset(sourceFile, contents)) {
104
+ const nodePatterns = [
105
+ /new\s+URL\(\s*(['"])(\.\.?\/[^'"]+)\1\s*,\s*import\.meta\.url\s*\)/g,
106
+ /path\.join\(\s*__dirname\s*,\s*(['"])(\.\.?\/[^'"]+|[^.'"/][^'"]*)\1\s*\)/g,
107
+ ];
108
+ for (const pattern of nodePatterns) {
109
+ for (const match of contents.matchAll(pattern))
110
+ recordRelative(sourceFile, match[2]);
111
+ }
112
+ continue;
113
+ }
114
+ const aliases = shellLocationAliases(contents);
115
+ const commandLines = contents.split(/\r?\n/).filter((line) => !/^\s*#/.test(line) &&
116
+ (/\b(?:source|exec|bash|sh|node)\b/.test(line) || /^\s*\.\s+/.test(line)));
117
+ for (const line of commandLines) {
118
+ SCRIPT_ROOT_TOKENS.lastIndex = 0;
119
+ for (const match of line.matchAll(/(?:\$\{SCRIPT_DIR\}|\$SCRIPT_DIR)\/([^"'`\s;|&)]+)/g)) {
120
+ recordRelative(sourceFile, match[1]);
121
+ }
122
+ const dirnamePath = new RegExp(String.raw `\$\(\s*dirname\s+["']?${BASH_SOURCE_TOKEN}["']?\s*\)(\/[^"'\x60\s;|&)]+)`, "g");
123
+ for (const match of line.matchAll(dirnamePath))
124
+ recordRelative(sourceFile, match[1]);
125
+ for (const [alias, location] of aliases) {
126
+ const escapedAlias = alias.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
127
+ const aliasPath = new RegExp(String.raw `(?:\$\{${escapedAlias}\}|\$${escapedAlias})\/([^"'\x60\s;|&)]+)`, "g");
128
+ for (const match of line.matchAll(aliasPath)) {
129
+ if (location.kind === "hq-root") {
130
+ const reference = match[0];
131
+ allowedHqRoot.set(`${referringAsset}\0${reference}`, { referringAsset, reference });
132
+ }
133
+ else {
134
+ recordRelative(sourceFile, match[1], location.baseDirectory);
135
+ }
136
+ }
137
+ }
138
+ const relativeCommand = /(?:\b(?:source|exec|bash|sh|node)\s+|^\s*\.\s+)(?:"(\.\.?\/[^"]+)"|'(\.\.?\/[^']+)'|(\.\.?\/[^\s;|&)]+))/g;
139
+ for (const match of line.matchAll(relativeCommand)) {
140
+ recordRelative(sourceFile, match[1] ?? match[2] ?? match[3]);
141
+ }
142
+ }
143
+ }
144
+ return {
145
+ missing: missing.sort((a, b) => `${a.referringAsset}\0${a.targetAsset}`.localeCompare(`${b.referringAsset}\0${b.targetAsset}`)),
146
+ allowedHqRoot: [...allowedHqRoot.values()].sort((a, b) => `${a.referringAsset}\0${a.reference}`.localeCompare(`${b.referringAsset}\0${b.reference}`)),
147
+ };
148
+ }
149
+ export function assertNoMissingScaffoldSiblings(scan) {
150
+ if (scan.missing.length === 0)
151
+ return;
152
+ throw new Error(scan.missing
153
+ .map(({ referringAsset, targetAsset }) => `${referringAsset} references missing ${targetAsset}`)
154
+ .join("\n"));
155
+ }
156
+ //# sourceMappingURL=scaffold-sibling-references.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indigoai-us/hq-cli",
3
- "version": "5.273.0-alpha.0",
3
+ "version": "5.274.0",
4
4
  "description": "HQ by Indigo management CLI — modules and cloud sync",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -44,7 +44,7 @@
44
44
  "dependencies": {
45
45
  "@aws-sdk/client-iot-data-plane": "^3.1096.0",
46
46
  "@aws-sdk/client-s3": "^3.1049.0",
47
- "@indigoai-us/hq-cloud": "~6.18.13",
47
+ "@indigoai-us/hq-cloud": "~6.18.10",
48
48
  "@indigoai-us/hq-flags-client": "^0.1.2",
49
49
  "@sentry/node": "^10.49.0",
50
50
  "@tobilu/qmd": "2.5.3",
@@ -1,14 +0,0 @@
1
- import type { Command } from "commander";
2
- import { type TrackerStore } from "../lib/lanes/tracker-store.js";
3
- import type { LaneCompanyRef } from "../lib/lanes/types.js";
4
- type WrapHandler = <Args extends unknown[]>(action: (...args: Args) => Promise<void>) => (...args: Args) => Promise<void>;
5
- export interface LaneTrackerImportDeps {
6
- hqRoot: () => string;
7
- resolveCompany: (company?: string) => Promise<LaneCompanyRef>;
8
- trackerEnabled: (company: LaneCompanyRef) => boolean | Promise<boolean>;
9
- now: () => Date;
10
- store?: (projectDirectory: string) => TrackerStore;
11
- }
12
- export declare function registerLaneTrackerImportCommand(parent: Command, deps: LaneTrackerImportDeps, wrap: WrapHandler): void;
13
- export {};
14
- //# sourceMappingURL=lanes-import.d.ts.map