@indigoai-us/hq-cli 5.345.252 → 5.345.254

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 (67) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/contracts/host-canary-release.json +11 -5
  3. package/dist/command-catalog.generated.d.ts +209 -0
  4. package/dist/command-catalog.generated.js +257 -0
  5. package/dist/command-registration-plan.d.ts +6 -0
  6. package/dist/command-registration-plan.js +1 -0
  7. package/dist/commands/ci-intake.d.ts +32 -0
  8. package/dist/commands/ci-intake.js +294 -0
  9. package/dist/commands/ci-metrics.d.ts +8 -0
  10. package/dist/commands/ci-metrics.js +55 -0
  11. package/dist/commands/ci-priorities.d.ts +56 -0
  12. package/dist/commands/ci-priorities.js +144 -0
  13. package/dist/commands/ci.d.ts +13 -0
  14. package/dist/commands/ci.js +11 -0
  15. package/dist/commands/cloud.d.ts +11 -0
  16. package/dist/commands/cloud.js +76 -0
  17. package/dist/commands/files.d.ts +62 -0
  18. package/dist/commands/files.js +249 -8
  19. package/dist/lib/bot/fleet-cron.d.ts +15 -0
  20. package/dist/lib/bot/fleet-cron.js +119 -20
  21. package/dist/lib/daemon/run.js +4 -3
  22. package/dist/lib/daemon/verified-jq.d.ts +6 -0
  23. package/dist/lib/daemon/verified-jq.js +17 -5
  24. package/dist/lib/delivery/migrations.d.ts +32 -1
  25. package/dist/lib/delivery/migrations.js +69 -8
  26. package/dist/lib/hook-engine/adapter-core-pin.d.ts +2 -1
  27. package/dist/lib/hook-engine/adapter-core-pin.js +2 -1
  28. package/dist/lib/hook-engine/coverage.d.ts +15 -0
  29. package/dist/lib/hook-engine/coverage.js +62 -1
  30. package/dist/lib/hook-engine/fleet-registration.d.ts +4 -0
  31. package/dist/lib/hook-engine/fleet-registration.js +25 -3
  32. package/dist/lib/smart-ci/cost.d.ts +72 -0
  33. package/dist/lib/smart-ci/cost.js +120 -0
  34. package/dist/lib/smart-ci/github.d.ts +112 -0
  35. package/dist/lib/smart-ci/github.js +267 -0
  36. package/dist/lib/smart-ci/intake.d.ts +288 -0
  37. package/dist/lib/smart-ci/intake.js +1078 -0
  38. package/dist/lib/smart-ci/ledger.d.ts +218 -0
  39. package/dist/lib/smart-ci/ledger.js +527 -0
  40. package/dist/lib/smart-ci/metrics.d.ts +137 -0
  41. package/dist/lib/smart-ci/metrics.js +249 -0
  42. package/dist/lib/smart-ci/priorities.d.ts +331 -0
  43. package/dist/lib/smart-ci/priorities.js +964 -0
  44. package/dist/lib/smart-ci/priority-refresh.d.ts +192 -0
  45. package/dist/lib/smart-ci/priority-refresh.js +366 -0
  46. package/dist/lib/smart-ci/priority-snapshots.d.ts +88 -0
  47. package/dist/lib/smart-ci/priority-snapshots.js +233 -0
  48. package/dist/lib/smart-ci/records.d.ts +265 -0
  49. package/dist/lib/smart-ci/records.js +281 -0
  50. package/dist/lib/smart-ci/reducer.d.ts +67 -0
  51. package/dist/lib/smart-ci/reducer.js +261 -0
  52. package/dist/lib/smart-ci/sources.d.ts +294 -0
  53. package/dist/lib/smart-ci/sources.js +659 -0
  54. package/dist/lib/smart-ci/text.d.ts +24 -0
  55. package/dist/lib/smart-ci/text.js +83 -0
  56. package/dist/lib/smart-ci/work-in-flight.d.ts +68 -0
  57. package/dist/lib/smart-ci/work-in-flight.js +154 -0
  58. package/dist/lib/sync/cli-manifest-reconcile.d.ts +20 -0
  59. package/dist/lib/sync/cli-manifest-reconcile.js +170 -0
  60. package/dist/lib/sync-core/engine-holds.d.ts +14 -0
  61. package/dist/lib/sync-core/engine-holds.js +78 -11
  62. package/dist/lib/sync-core/hand-back.d.ts +1 -0
  63. package/dist/lib/sync-core/hand-back.js +7 -2
  64. package/dist/lib/sync-core/reconcile.js +10 -2
  65. package/dist/utils/host-registration.d.ts +1 -0
  66. package/dist/utils/host-registration.js +1 -1
  67. package/package.json +9 -7
@@ -0,0 +1,294 @@
1
+ export type SourceName = "standups" | "work-mesh" | "sessions" | "ontology" | "pull-requests";
2
+ export declare const PRIORITY_SOURCES: readonly SourceName[];
3
+ /**
4
+ * The kinds of record these readers return: a standup or meeting, a Work Mesh
5
+ * thread, project, lane and story, and a session. Every source is full of
6
+ * these words whatever the company works on (thread ids, session ids, "the
7
+ * lane", "this project"), so they describe the tooling the map reads from and
8
+ * never a piece of the company's work. The map does not take them as topic
9
+ * terms. A project whose name is made of them is still listed, under its id.
10
+ */
11
+ export declare const RECORD_KIND_WORDS: ReadonlySet<string>;
12
+ /** Thrown by a reader when its source cannot be read. The refresh logs it and keeps the last good map. */
13
+ export declare class SourceUnavailableError extends Error {
14
+ readonly source: SourceName;
15
+ constructor(source: SourceName, message: string);
16
+ }
17
+ /** Refuse anything that is not a plain company slug before it reaches a path or a command. */
18
+ export declare function assertCompanySlug(company: unknown): asserts company is string;
19
+ export interface CommandResult {
20
+ stdout: string;
21
+ /** The program's exit code. A runner resolves for any exit code. */
22
+ exitCode: number;
23
+ }
24
+ /** Runs a program and resolves with its stdout and exit code, or rejects when it cannot be run or times out. */
25
+ export type CommandRunner = (file: string, args: string[], opts: {
26
+ timeoutMs: number;
27
+ env?: NodeJS.ProcessEnv;
28
+ }) => Promise<CommandResult>;
29
+ export declare const execRunner: CommandRunner;
30
+ /** How to start the `hq` CLI: a program and the arguments that go before the subcommand. */
31
+ export interface HqCommand {
32
+ file: string;
33
+ prefix: string[];
34
+ }
35
+ /** The running CLI itself, so the readers use the same build and login as the caller. */
36
+ export declare function defaultHqCommand(): HqCommand;
37
+ export interface Utterance {
38
+ speaker: string;
39
+ /** Offset range inside the recording, as written in the transcript. */
40
+ at: string;
41
+ text: string;
42
+ }
43
+ export interface StandupTranscript {
44
+ id: string;
45
+ /** Path relative to the HQ root. */
46
+ file: string;
47
+ title: string;
48
+ /** Calendar day of the meeting (YYYY-MM-DD). */
49
+ date: string;
50
+ startedAt: string;
51
+ /** True when the file had no usable title and was taken as a standup from who spoke in it. */
52
+ titleInferred: boolean;
53
+ utterances: Utterance[];
54
+ }
55
+ /** How often each term is said outside standups, counted per utterance. */
56
+ export interface BackgroundStats {
57
+ utterances: number;
58
+ termUtterances: Record<string, number>;
59
+ transcripts: number;
60
+ }
61
+ export interface StandupRead {
62
+ standups: StandupTranscript[];
63
+ background: BackgroundStats;
64
+ /** Transcripts skipped because their frontmatter named another company. */
65
+ skippedOtherCompany: number;
66
+ gaps: string[];
67
+ }
68
+ interface MeetingHeader {
69
+ title: string;
70
+ scheduledStart: string;
71
+ createdAt: string;
72
+ companyId: string;
73
+ }
74
+ /**
75
+ * The fields the map needs from a transcript's header. The fence is split by
76
+ * the shared helper and the YAML is parsed as YAML (timestamps stay text).
77
+ * Null when the text has no header or the header is not a YAML mapping.
78
+ */
79
+ export declare function readMeetingHeader(text: string): MeetingHeader | null;
80
+ /**
81
+ * The company's own cloud uid, from its company.yaml. Used to skip
82
+ * transcripts of another company when Work Mesh is not there to say the uid.
83
+ * "" when the file is missing or names no uid.
84
+ */
85
+ export declare function companyUidFromFile(hqRoot: string, company: string): string;
86
+ export declare function parseUtterances(text: string): Utterance[];
87
+ export interface StandupReadOptions {
88
+ hqRoot: string;
89
+ company: string;
90
+ /** Window of standups to read, as epoch milliseconds: from <= start < to. */
91
+ fromMs: number;
92
+ toMs: number;
93
+ /** The company's uid. Transcripts naming another uid are skipped. Default: read from the company's own company.yaml. */
94
+ companyUid?: string;
95
+ /** How far back non-standup meetings are read for the background counts. Default 30 days. */
96
+ backgroundDays?: number;
97
+ /** Most background transcripts to read. Default 400. */
98
+ backgroundLimit?: number;
99
+ /** Share of an untitled meeting's speakers that must also speak in titled standups. Default 0.6. */
100
+ speakerOverlap?: number;
101
+ }
102
+ /** The meetings folder of one company. The slug is checked before it is put in a path. */
103
+ export declare function meetingsDir(hqRoot: string, company: string): string;
104
+ /**
105
+ * Read the standup transcripts in the window, plus term counts from the same
106
+ * company's other meetings (the background that tells a standup topic from
107
+ * ordinary talk). Standups are found by title and start time in the
108
+ * frontmatter. A meeting stored without a title is taken as a standup when
109
+ * most of its speakers also speak in the titled standups, and is reported as
110
+ * a gap.
111
+ */
112
+ export declare function readStandups(opts: StandupReadOptions): StandupRead;
113
+ /** Ids of standup-titled transcripts that started at or after `sinceMs`, read from frontmatter only. */
114
+ export declare function listStandupIdsSince(hqRoot: string, company: string, sinceMs: number): string[];
115
+ export interface MeshThread {
116
+ threadId: string;
117
+ kind: "project" | "lane" | "work-session" | "other";
118
+ projectId: string;
119
+ status: string;
120
+ ownerUid: string;
121
+ priority: string;
122
+ createdAt: string;
123
+ lastActivityAt: string;
124
+ /** Session the thread belongs to (work sessions and lanes), or "". */
125
+ sessionId: string;
126
+ summary: string;
127
+ }
128
+ export interface MeshStory {
129
+ id: string;
130
+ title: string;
131
+ status: string;
132
+ assignee: string;
133
+ updatedAt: string;
134
+ }
135
+ export interface MeshProject {
136
+ projectId: string;
137
+ name: string;
138
+ description: string;
139
+ repos: string[];
140
+ updatedAt: string;
141
+ stories: MeshStory[];
142
+ }
143
+ export interface WorkMeshRead {
144
+ companyUid: string;
145
+ threads: MeshThread[];
146
+ projects: MeshProject[];
147
+ /** Person or agent uid to display name, from the project cache. */
148
+ names: Record<string, string>;
149
+ }
150
+ export interface CliReadOptions {
151
+ company: string;
152
+ run?: CommandRunner;
153
+ hq?: HqCommand;
154
+ timeoutMs?: number;
155
+ }
156
+ export declare function normalizeThread(raw: unknown): MeshThread | null;
157
+ export declare function normalizeProject(raw: unknown, names: Record<string, string>): MeshProject | null;
158
+ export interface WorkMeshReadOptions extends CliReadOptions {
159
+ /** Folder holding the Work Mesh cache. Default ~/.hq/work-mesh/cache. */
160
+ cacheDir?: string;
161
+ }
162
+ /** Threads from `hq mesh check`, and project detail from the cache folder of the uid Work Mesh returned. */
163
+ export declare function readWorkMesh(opts: WorkMeshReadOptions): Promise<WorkMeshRead>;
164
+ export interface LiveSession {
165
+ sessionId: string;
166
+ owner: string;
167
+ ownerType: string;
168
+ status: string;
169
+ repo: string;
170
+ branch: string;
171
+ folder: string;
172
+ startedAt: string;
173
+ lastTurnAt: string;
174
+ }
175
+ export interface SessionsRead {
176
+ generatedAt: string;
177
+ sessions: LiveSession[];
178
+ /** Actor uid to display name. */
179
+ names: Record<string, string>;
180
+ }
181
+ /** Open HQ sessions for the company, from the company-wide live read. */
182
+ export declare function readSessions(opts: CliReadOptions): Promise<SessionsRead>;
183
+ export interface OntologyEdge {
184
+ verb: string;
185
+ target: string;
186
+ name: string;
187
+ src: string;
188
+ date: string;
189
+ }
190
+ export interface OntologyEntity {
191
+ id: string;
192
+ name: string;
193
+ aliases: string[];
194
+ repo: string;
195
+ status: string;
196
+ summary: string;
197
+ owner: string;
198
+ ownerSource: string;
199
+ /** Newest date on any fact or edge. */
200
+ date: string;
201
+ edges: OntologyEdge[];
202
+ }
203
+ export interface OntologyRead {
204
+ /** Project names from the brief, most recently active first. */
205
+ activeProjects: string[];
206
+ customers: string[];
207
+ /** Entities looked up, keyed by the name asked for. */
208
+ entities: Record<string, OntologyEntity>;
209
+ /** Names that did not resolve, and resolved entities with no relationships. */
210
+ gaps: string[];
211
+ }
212
+ export interface OntologyReadOptions extends CliReadOptions {
213
+ /** Names to look up after the brief (project slugs). */
214
+ lookups?: string[];
215
+ /**
216
+ * When the whole read has to be over (epoch milliseconds, real clock). Each
217
+ * `hq` call is started with what is left, so no child outlives it. Names
218
+ * not reached in time are reported as gaps.
219
+ */
220
+ deadlineMs?: number;
221
+ }
222
+ /** The ontology brief, then lookup and neighbors for each name asked for. */
223
+ export declare function readOntology(opts: OntologyReadOptions): Promise<OntologyRead>;
224
+ export interface PullRequest {
225
+ /** owner/name */
226
+ repo: string;
227
+ number: number;
228
+ title: string;
229
+ branch: string;
230
+ labels: string[];
231
+ author: string;
232
+ draft: boolean;
233
+ createdAt: string;
234
+ updatedAt: string;
235
+ url: string;
236
+ body: string;
237
+ /** Commit at the head of the branch. The changed paths are cached under it. */
238
+ headSha: string;
239
+ /**
240
+ * Paths of the files the pull request changes, when they have been read
241
+ * (readPullRequestPaths: one request per pull request, so the refresh reads
242
+ * them only for pull requests nothing else matched, and caches them).
243
+ */
244
+ paths?: string[];
245
+ }
246
+ export interface PullRequestReadOptions {
247
+ repos: string[];
248
+ run?: CommandRunner;
249
+ /** The gh program. Default "gh". */
250
+ gh?: string;
251
+ timeoutMs?: number;
252
+ }
253
+ /** The caller's environment without the shared GitHub token variables. */
254
+ export declare function ghEnvironment(env?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
255
+ /** The exact arguments of the one GitHub call this module makes per repo. A GET; it changes nothing. */
256
+ export declare function pullRequestArgs(repo: string): string[];
257
+ /** Open pull requests of each repo, read with one paginated GET per repo. */
258
+ export declare function readPullRequests(opts: PullRequestReadOptions): Promise<PullRequest[]>;
259
+ /** The exact arguments of the one GitHub call made per pull request for its changed files. A GET; it changes nothing. */
260
+ export declare function pullRequestFilesArgs(repo: string, number: number): string[];
261
+ /**
262
+ * The paths of the files one pull request changes: its first 100, in one GET.
263
+ * Null when they could not be read; the pull request is then matched without
264
+ * them.
265
+ */
266
+ export declare function readPullRequestPaths(opts: {
267
+ repo: string;
268
+ number: number;
269
+ run?: CommandRunner;
270
+ gh?: string;
271
+ timeoutMs?: number;
272
+ }): Promise<string[] | null>;
273
+ /** What a project's own plan says about where its work lands. */
274
+ export interface ProjectPlan {
275
+ projectId: string;
276
+ /** Repo name without the owner, or "" when the plan names none. */
277
+ repo: string;
278
+ /** The branch the plan names for the project, or "". */
279
+ branch: string;
280
+ /** Files and folders in the project's repo that its stories list, as repo-relative paths. */
281
+ files: string[];
282
+ }
283
+ /**
284
+ * Read the plans (prd.json) of the named projects from the company's own
285
+ * projects folder. A project with no plan, or an unreadable one, is left out:
286
+ * the plan is supporting evidence, not a source the map depends on.
287
+ */
288
+ export declare function readProjectPlans(opts: {
289
+ hqRoot: string;
290
+ company: string;
291
+ projectIds: string[];
292
+ }): Record<string, ProjectPlan>;
293
+ export {};
294
+ //# sourceMappingURL=sources.d.ts.map