@indigoai-us/hq-cli 5.58.1 → 5.60.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.
- package/dist/commands/channels.d.ts +16 -0
- package/dist/commands/channels.js +78 -0
- package/dist/commands/dm.d.ts +41 -0
- package/dist/commands/dm.js +159 -10
- package/dist/commands/meetings.js +127 -14
- package/dist/commands/secrets.js +7 -3
- package/dist/index.js +4 -2
- package/package.json +1 -1
- package/src/commands/channels.test.ts +74 -0
- package/src/commands/channels.ts +88 -0
- package/src/commands/dm.test.ts +129 -0
- package/src/commands/dm.ts +208 -10
- package/src/commands/meetings.test.ts +116 -2
- package/src/commands/meetings.ts +206 -37
- package/src/commands/secrets.test.ts +89 -0
- package/src/commands/secrets.ts +5 -1
- package/src/index.ts +2 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { type ChannelSummary } from "./dm.js";
|
|
3
|
+
/**
|
|
4
|
+
* Human label for a channel row. Named channels (personal/company) show their
|
|
5
|
+
* name + a `hq dm <slug>` hint; unnamed group DMs are identified by their
|
|
6
|
+
* members (caller excluded), matching how HQ Sync renders them. Pure →
|
|
7
|
+
* unit-testable.
|
|
8
|
+
*/
|
|
9
|
+
export declare function describeChannel(c: ChannelSummary): string;
|
|
10
|
+
/**
|
|
11
|
+
* Render the caller's channels for `hq channels`. Pure (takes the already
|
|
12
|
+
* fetched list) so the formatting is unit-testable without network/auth.
|
|
13
|
+
*/
|
|
14
|
+
export declare function formatChannelsList(channels: ChannelSummary[]): string;
|
|
15
|
+
export declare function registerChannelsCommand(program: Command): void;
|
|
16
|
+
//# sourceMappingURL=channels.d.ts.map
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="891a3265-c9ff-53d8-8a3c-2a964f5a74b6")}catch(e){}}();
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import { ensureCognitoToken } from "../utils/cognito-session.js";
|
|
5
|
+
import { vaultApiFetch } from "../utils/vault-api.js";
|
|
6
|
+
import { channelSlug } from "./dm.js";
|
|
7
|
+
/**
|
|
8
|
+
* Human label for a channel row. Named channels (personal/company) show their
|
|
9
|
+
* name + a `hq dm <slug>` hint; unnamed group DMs are identified by their
|
|
10
|
+
* members (caller excluded), matching how HQ Sync renders them. Pure →
|
|
11
|
+
* unit-testable.
|
|
12
|
+
*/
|
|
13
|
+
export function describeChannel(c) {
|
|
14
|
+
if (c.scope === "group") {
|
|
15
|
+
const names = (c.members ?? [])
|
|
16
|
+
.map((m) => m.displayName)
|
|
17
|
+
.filter((n) => !!n);
|
|
18
|
+
const who = names.length > 0
|
|
19
|
+
? names.join(", ")
|
|
20
|
+
: `${c.memberCount ?? "?"}-person group`;
|
|
21
|
+
return `${who} ${chalk.dim("(group DM)")}`;
|
|
22
|
+
}
|
|
23
|
+
const slug = c.slug ?? (c.name ? channelSlug(c.name) : "");
|
|
24
|
+
const scopeTag = c.scope ? chalk.dim(`(${c.scope})`) : "";
|
|
25
|
+
const hint = slug ? chalk.dim(`— hq dm ${slug} "…"`) : "";
|
|
26
|
+
return `${chalk.bold(c.name ?? slug ?? c.channelId)} ${scopeTag} ${hint}`.trim();
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Render the caller's channels for `hq channels`. Pure (takes the already
|
|
30
|
+
* fetched list) so the formatting is unit-testable without network/auth.
|
|
31
|
+
*/
|
|
32
|
+
export function formatChannelsList(channels) {
|
|
33
|
+
if (channels.length === 0) {
|
|
34
|
+
return chalk.dim("No channels yet. Group DMs and named channels you're in will appear here.");
|
|
35
|
+
}
|
|
36
|
+
const lines = [
|
|
37
|
+
chalk.green(`${channels.length} channel${channels.length === 1 ? "" : "s"}:`),
|
|
38
|
+
];
|
|
39
|
+
for (const c of channels) {
|
|
40
|
+
lines.push(` ${describeChannel(c)}`);
|
|
41
|
+
}
|
|
42
|
+
return lines.join("\n");
|
|
43
|
+
}
|
|
44
|
+
async function runChannelsList() {
|
|
45
|
+
try {
|
|
46
|
+
const token = await ensureCognitoToken();
|
|
47
|
+
const res = await vaultApiFetch({ token, path: "/v1/notify/channels" });
|
|
48
|
+
if (!res.ok) {
|
|
49
|
+
if (res.status === 401) {
|
|
50
|
+
console.error(chalk.red("Not authenticated — run `hq login` and try again."));
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
const err = (await res.json().catch(() => ({})));
|
|
54
|
+
console.error(chalk.red(`Could not list channels: ${err.error ?? err.message ?? res.statusText}`));
|
|
55
|
+
}
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
const data = (await res.json());
|
|
59
|
+
console.log(formatChannelsList(data.channels ?? []));
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
console.error(chalk.red("Error:"), err instanceof Error ? err.message : String(err));
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
export function registerChannelsCommand(program) {
|
|
67
|
+
const channels = program
|
|
68
|
+
.command("channels")
|
|
69
|
+
.description("List the DM channels you're in (name them with `hq dm <name> \"…\"`).");
|
|
70
|
+
channels
|
|
71
|
+
.command("list", { isDefault: true })
|
|
72
|
+
.description("List your DM channels — named channels and group DMs.")
|
|
73
|
+
.action(async () => {
|
|
74
|
+
await runChannelsList();
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=channels.js.map
|
|
78
|
+
//# debugId=891a3265-c9ff-53d8-8a3c-2a964f5a74b6
|
package/dist/commands/dm.d.ts
CHANGED
|
@@ -16,6 +16,47 @@ export declare function detectRecipient(recipient: string): DmRecipient | null;
|
|
|
16
16
|
* (the normal 1:1 path). Pure → unit-testable.
|
|
17
17
|
*/
|
|
18
18
|
export declare function parseGroupRecipients(recipient: string): string[] | null;
|
|
19
|
+
/**
|
|
20
|
+
* Normalize a channel name into a stable slug for name matching. MIRRORS the
|
|
21
|
+
* server's `channelSlug` (hq-pro src/vault-service/lib/channels.ts): lowercase,
|
|
22
|
+
* collapse runs of non-alphanumerics to single hyphens, trim leading/trailing
|
|
23
|
+
* hyphens. Keep in lockstep with the server so `hq dm vyg-dev` matches the
|
|
24
|
+
* channel the server stored as slug `vyg-dev`. Pure → unit-testable.
|
|
25
|
+
*/
|
|
26
|
+
export declare function channelSlug(name: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Decide whether a positional recipient token addresses a DM CHANNEL by name
|
|
29
|
+
* (rather than a person/agent or a group). Returns the bare channel name to
|
|
30
|
+
* resolve, or null when the token is a person path (email / prs_ / agt_ uid) or
|
|
31
|
+
* a comma group. Pure → unit-testable.
|
|
32
|
+
*
|
|
33
|
+
* "#vyg-dev" → "vyg-dev" (explicit hash form)
|
|
34
|
+
* "vyg-dev" → "vyg-dev" (bare name — not an email/uid/group)
|
|
35
|
+
* "a@b.com" → null (person)
|
|
36
|
+
* "prs_…" → null (person) "agt_…" → null (agent)
|
|
37
|
+
* "a@x,b@y" → null (group DM)
|
|
38
|
+
*/
|
|
39
|
+
export declare function parseChannelName(recipient: string): string | null;
|
|
40
|
+
/** Minimal channel shape the CLI reads back from GET /v1/notify/channels. */
|
|
41
|
+
export interface ChannelSummary {
|
|
42
|
+
channelId: string;
|
|
43
|
+
name?: string;
|
|
44
|
+
slug?: string;
|
|
45
|
+
scope?: string;
|
|
46
|
+
memberCount?: number;
|
|
47
|
+
members?: {
|
|
48
|
+
personUid: string;
|
|
49
|
+
displayName?: string;
|
|
50
|
+
}[];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Find the caller's channel(s) whose name matches `name`, by slug or
|
|
54
|
+
* case-insensitive display name. Group DMs are unnamed (participant-keyed), so
|
|
55
|
+
* they never match a name. Returns ALL matches so the caller can detect an
|
|
56
|
+
* ambiguous name (same slug across personal + company scope). Pure →
|
|
57
|
+
* unit-testable.
|
|
58
|
+
*/
|
|
59
|
+
export declare function matchChannelsByName(channels: ChannelSummary[], name: string): ChannelSummary[];
|
|
19
60
|
/**
|
|
20
61
|
* Parse a relative duration like `30s`, `10m`, `2h`, `1d` into milliseconds.
|
|
21
62
|
* Returns null on anything that doesn't match. Pure → unit-testable.
|
package/dist/commands/dm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e95f345b-0e15-52b3-a851-fc97da935a99")}catch(e){}}();
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
import { readFileSync } from "node:fs";
|
|
5
5
|
import { ensureCognitoToken } from "../utils/cognito-session.js";
|
|
@@ -37,6 +37,72 @@ export function parseGroupRecipients(recipient) {
|
|
|
37
37
|
.filter(Boolean);
|
|
38
38
|
return [...new Set(parts)];
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Normalize a channel name into a stable slug for name matching. MIRRORS the
|
|
42
|
+
* server's `channelSlug` (hq-pro src/vault-service/lib/channels.ts): lowercase,
|
|
43
|
+
* collapse runs of non-alphanumerics to single hyphens, trim leading/trailing
|
|
44
|
+
* hyphens. Keep in lockstep with the server so `hq dm vyg-dev` matches the
|
|
45
|
+
* channel the server stored as slug `vyg-dev`. Pure → unit-testable.
|
|
46
|
+
*/
|
|
47
|
+
export function channelSlug(name) {
|
|
48
|
+
return name
|
|
49
|
+
.trim()
|
|
50
|
+
.toLowerCase()
|
|
51
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
52
|
+
.replace(/^-+|-+$/g, "");
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Decide whether a positional recipient token addresses a DM CHANNEL by name
|
|
56
|
+
* (rather than a person/agent or a group). Returns the bare channel name to
|
|
57
|
+
* resolve, or null when the token is a person path (email / prs_ / agt_ uid) or
|
|
58
|
+
* a comma group. Pure → unit-testable.
|
|
59
|
+
*
|
|
60
|
+
* "#vyg-dev" → "vyg-dev" (explicit hash form)
|
|
61
|
+
* "vyg-dev" → "vyg-dev" (bare name — not an email/uid/group)
|
|
62
|
+
* "a@b.com" → null (person)
|
|
63
|
+
* "prs_…" → null (person) "agt_…" → null (agent)
|
|
64
|
+
* "a@x,b@y" → null (group DM)
|
|
65
|
+
*/
|
|
66
|
+
export function parseChannelName(recipient) {
|
|
67
|
+
const r = recipient.trim();
|
|
68
|
+
if (!r)
|
|
69
|
+
return null;
|
|
70
|
+
if (r.startsWith("#")) {
|
|
71
|
+
const name = r.slice(1).trim();
|
|
72
|
+
return name || null;
|
|
73
|
+
}
|
|
74
|
+
// A comma is the group-DM signal; emails and prs_/agt_ uids are person paths.
|
|
75
|
+
if (r.includes(","))
|
|
76
|
+
return null;
|
|
77
|
+
if (EMAIL_PATTERN.test(r))
|
|
78
|
+
return null;
|
|
79
|
+
if (RECIPIENT_UID_PATTERN.test(r))
|
|
80
|
+
return null;
|
|
81
|
+
return r;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Find the caller's channel(s) whose name matches `name`, by slug or
|
|
85
|
+
* case-insensitive display name. Group DMs are unnamed (participant-keyed), so
|
|
86
|
+
* they never match a name. Returns ALL matches so the caller can detect an
|
|
87
|
+
* ambiguous name (same slug across personal + company scope). Pure →
|
|
88
|
+
* unit-testable.
|
|
89
|
+
*/
|
|
90
|
+
export function matchChannelsByName(channels, name) {
|
|
91
|
+
const targetSlug = channelSlug(name);
|
|
92
|
+
const targetName = name.trim().toLowerCase();
|
|
93
|
+
if (!targetSlug && !targetName)
|
|
94
|
+
return [];
|
|
95
|
+
return channels.filter((c) => {
|
|
96
|
+
if (c.scope === "group")
|
|
97
|
+
return false;
|
|
98
|
+
const slug = c.slug ?? (c.name ? channelSlug(c.name) : "");
|
|
99
|
+
if (slug && slug === targetSlug)
|
|
100
|
+
return true;
|
|
101
|
+
if (c.name && c.name.trim().toLowerCase() === targetName)
|
|
102
|
+
return true;
|
|
103
|
+
return false;
|
|
104
|
+
});
|
|
105
|
+
}
|
|
40
106
|
/**
|
|
41
107
|
* Parse a relative duration like `30s`, `10m`, `2h`, `1d` into milliseconds.
|
|
42
108
|
* Returns null on anything that doesn't match. Pure → unit-testable.
|
|
@@ -266,13 +332,95 @@ async function runGroupSend(recipients, message) {
|
|
|
266
332
|
process.exit(1);
|
|
267
333
|
}
|
|
268
334
|
}
|
|
335
|
+
/** Fetch the caller's channels (GET /v1/notify/channels). */
|
|
336
|
+
async function fetchChannels(token) {
|
|
337
|
+
const res = await vaultApiFetch({ token, path: "/v1/notify/channels" });
|
|
338
|
+
if (!res.ok) {
|
|
339
|
+
const err = (await res.json().catch(() => ({})));
|
|
340
|
+
throw new Error(friendlyDmError(res.status, err.code, err.error ?? err.message ?? res.statusText));
|
|
341
|
+
}
|
|
342
|
+
const data = (await res.json());
|
|
343
|
+
return data.channels ?? [];
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Channel DM path: `hq dm vyg-dev "msg"`, `hq dm '#vyg-dev' "msg"`, or
|
|
347
|
+
* `hq dm --channel vyg-dev "msg"`. Resolves the caller's channel by name via
|
|
348
|
+
* GET /v1/notify/channels, then posts the message into it. Scheduling /
|
|
349
|
+
* prompt / details are 1:1-DM features and are rejected here rather than
|
|
350
|
+
* silently dropped.
|
|
351
|
+
*/
|
|
352
|
+
async function runChannelSend(channelName, message, opts) {
|
|
353
|
+
try {
|
|
354
|
+
const body = (message ?? "").trim();
|
|
355
|
+
if (!body) {
|
|
356
|
+
console.error(chalk.red(`A message body is required: hq dm ${channelName} "<message>" (or hq dm --channel ${channelName} "<message>").`));
|
|
357
|
+
process.exit(1);
|
|
358
|
+
}
|
|
359
|
+
const unsupported = [
|
|
360
|
+
opts.prompt || opts.promptFile ? "--prompt/--prompt-file" : null,
|
|
361
|
+
opts.details || opts.detailsFile ? "--details/--details-file" : null,
|
|
362
|
+
opts.at ? "--at" : null,
|
|
363
|
+
opts.in ? "--in" : null,
|
|
364
|
+
].filter(Boolean);
|
|
365
|
+
if (unsupported.length > 0) {
|
|
366
|
+
console.error(chalk.red(`${unsupported.join(", ")} ${unsupported.length === 1 ? "is" : "are"} only supported for 1:1 DMs, not channel messages.`));
|
|
367
|
+
process.exit(1);
|
|
368
|
+
}
|
|
369
|
+
const token = await ensureCognitoToken();
|
|
370
|
+
const channels = await fetchChannels(token);
|
|
371
|
+
const matches = matchChannelsByName(channels, channelName);
|
|
372
|
+
if (matches.length === 0) {
|
|
373
|
+
console.error(chalk.red(`No channel named '${channelName}' — run \`hq channels\` to see your channels.`));
|
|
374
|
+
process.exit(1);
|
|
375
|
+
}
|
|
376
|
+
if (matches.length > 1) {
|
|
377
|
+
const scopes = matches.map((m) => m.scope ?? "?").join(", ");
|
|
378
|
+
console.error(chalk.red(`'${channelName}' matches ${matches.length} channels (${scopes}) — this is ambiguous. Open the channel in HQ Sync to post, or rename one.`));
|
|
379
|
+
process.exit(1);
|
|
380
|
+
}
|
|
381
|
+
const channel = matches[0];
|
|
382
|
+
const sendRes = await vaultApiFetch({
|
|
383
|
+
token,
|
|
384
|
+
path: `/v1/notify/channels/${encodeURIComponent(channel.channelId)}/messages`,
|
|
385
|
+
method: "POST",
|
|
386
|
+
body: { body },
|
|
387
|
+
});
|
|
388
|
+
if (!sendRes.ok) {
|
|
389
|
+
const err = (await sendRes.json().catch(() => ({})));
|
|
390
|
+
console.error(chalk.red(friendlyDmError(sendRes.status, err.code, err.error ?? err.message ?? sendRes.statusText)));
|
|
391
|
+
process.exit(1);
|
|
392
|
+
}
|
|
393
|
+
console.log(chalk.green(`Message posted to #${channel.name ?? channelName}.`));
|
|
394
|
+
}
|
|
395
|
+
catch (err) {
|
|
396
|
+
console.error(chalk.red("Error:"), err instanceof Error ? err.message : String(err));
|
|
397
|
+
process.exit(1);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
269
400
|
async function runDmSend(recipient, message, opts) {
|
|
401
|
+
// --channel <name> is an explicit channel target; the positional carries the
|
|
402
|
+
// message (recipient slot), e.g. `hq dm --channel vyg-dev "hello"`.
|
|
403
|
+
if (opts.channel !== undefined) {
|
|
404
|
+
await runChannelSend(opts.channel, message ?? recipient, opts);
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
if (recipient === undefined) {
|
|
408
|
+
console.error(chalk.red('A recipient is required: hq dm <email|personUid|#channel> "<message>" (or --channel <name>).'));
|
|
409
|
+
process.exit(1);
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
270
412
|
// A comma in the recipient means a group DM — fan into the channel path.
|
|
271
413
|
const group = parseGroupRecipients(recipient);
|
|
272
414
|
if (group) {
|
|
273
415
|
await runGroupSend(group, message);
|
|
274
416
|
return;
|
|
275
417
|
}
|
|
418
|
+
// A bare name or #hash addresses a named DM channel.
|
|
419
|
+
const channelName = parseChannelName(recipient);
|
|
420
|
+
if (channelName !== null) {
|
|
421
|
+
await runChannelSend(channelName, message, opts);
|
|
422
|
+
return;
|
|
423
|
+
}
|
|
276
424
|
try {
|
|
277
425
|
// Resolve prompt/details from inline text or a file.
|
|
278
426
|
let prompt = opts.prompt;
|
|
@@ -354,14 +502,15 @@ export function registerDmCommand(program) {
|
|
|
354
502
|
.command("dm")
|
|
355
503
|
.description("Send a direct message and manage connection requests.");
|
|
356
504
|
dm
|
|
357
|
-
.command("send
|
|
358
|
-
.description('Send a direct message
|
|
359
|
-
.option("--
|
|
360
|
-
.option("--prompt
|
|
361
|
-
.option("--
|
|
362
|
-
.option("--details
|
|
363
|
-
.option("--
|
|
364
|
-
.option("--
|
|
505
|
+
.command("send [recipient] [message]", { isDefault: true, hidden: true })
|
|
506
|
+
.description('Send a direct message. RECIPIENT can be a person (email, personUid, or agentUid), a GROUP DM (comma-separated: "a@x.com,b@y.com"), or one of your DM CHANNELS by name — bare (hq dm vyg-dev "hi"), hash form (hq dm "#vyg-dev" "hi"), or via --channel (hq dm --channel vyg-dev "hi"). A person receives a DM as an HQ Sync notification; an agent receives it in its durable box inbox. If you aren\'t connected yet, it sends a connection request that holds your message. See your channels with `hq channels`.')
|
|
507
|
+
.option("--channel <name>", "Post the message to one of your DM channels by name (e.g. --channel vyg-dev)")
|
|
508
|
+
.option("--prompt <text>", "Agent-context prompt the recipient can one-click copy into their agent (1:1 DMs only)")
|
|
509
|
+
.option("--prompt-file <path>", "Read the agent prompt from a file (1:1 DMs only)")
|
|
510
|
+
.option("--details <text>", "Longer detail shown in the recipient's DM detail window (1:1 DMs only)")
|
|
511
|
+
.option("--details-file <path>", "Read the details from a file (1:1 DMs only)")
|
|
512
|
+
.option("--at <iso>", "Schedule delivery at an ISO8601 time (store-and-forward; delivered within ~60s of the time; 1:1 DMs only)")
|
|
513
|
+
.option("--in <duration>", "Schedule delivery after a relative delay: 30s, 10m, 2h, 1d (1:1 DMs only)")
|
|
365
514
|
.action(async (recipient, message, opts) => {
|
|
366
515
|
await runDmSend(recipient, message, opts);
|
|
367
516
|
});
|
|
@@ -391,4 +540,4 @@ export function registerDmCommand(program) {
|
|
|
391
540
|
});
|
|
392
541
|
}
|
|
393
542
|
//# sourceMappingURL=dm.js.map
|
|
394
|
-
//# debugId=
|
|
543
|
+
//# debugId=e95f345b-0e15-52b3-a851-fc97da935a99
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="6bb33e65-134a-5b0a-917b-ca084d4c8366")}catch(e){}}();
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
import { ensureCognitoToken } from "../utils/cognito-session.js";
|
|
5
5
|
import { vaultApiFetch, getCompanyUid } from "../utils/vault-api.js";
|
|
@@ -13,6 +13,17 @@ function formatDuration(seconds) {
|
|
|
13
13
|
return `${m}m ${s}s`;
|
|
14
14
|
return `${s}s`;
|
|
15
15
|
}
|
|
16
|
+
function safeFormatDuration(seconds) {
|
|
17
|
+
return typeof seconds === "number" && Number.isFinite(seconds) ? formatDuration(seconds) : "-";
|
|
18
|
+
}
|
|
19
|
+
function safeFormatDate(iso, options) {
|
|
20
|
+
if (typeof iso !== "string" || iso.length === 0)
|
|
21
|
+
return "-";
|
|
22
|
+
const date = new Date(iso);
|
|
23
|
+
if (Number.isNaN(date.getTime()))
|
|
24
|
+
return "-";
|
|
25
|
+
return options ? date.toLocaleString("en-US", options) : date.toLocaleString();
|
|
26
|
+
}
|
|
16
27
|
function formatTimestamp(ts) {
|
|
17
28
|
const m = Math.floor(ts / 60);
|
|
18
29
|
const s = Math.floor(ts % 60);
|
|
@@ -32,6 +43,38 @@ function statusBadge(status) {
|
|
|
32
43
|
return chalk.dim(status);
|
|
33
44
|
}
|
|
34
45
|
}
|
|
46
|
+
function isMarkdownShape(x) {
|
|
47
|
+
if (!x || typeof x !== "object")
|
|
48
|
+
return false;
|
|
49
|
+
const candidate = x;
|
|
50
|
+
return candidate.sourceShape === "markdown" || Boolean(candidate.source?.frontmatter);
|
|
51
|
+
}
|
|
52
|
+
function hasSignals(signals) {
|
|
53
|
+
return Boolean(signals &&
|
|
54
|
+
typeof signals === "object" &&
|
|
55
|
+
!Array.isArray(signals) &&
|
|
56
|
+
Object.keys(signals).length > 0);
|
|
57
|
+
}
|
|
58
|
+
function renderSignals(signals) {
|
|
59
|
+
console.log(chalk.bold("Signals"));
|
|
60
|
+
for (const [key, value] of Object.entries(signals)) {
|
|
61
|
+
if (value === null || value === undefined) {
|
|
62
|
+
console.log(` ${key}: -`);
|
|
63
|
+
}
|
|
64
|
+
else if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
65
|
+
console.log(` ${key}: ${String(value)}`);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
const rendered = JSON.stringify(value, null, 2)
|
|
69
|
+
.split("\n")
|
|
70
|
+
.map((line) => ` ${line}`)
|
|
71
|
+
.join("\n");
|
|
72
|
+
console.log(` ${key}:`);
|
|
73
|
+
console.log(rendered);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
console.log();
|
|
77
|
+
}
|
|
35
78
|
async function resolveShortId(token, prefix, query) {
|
|
36
79
|
if (prefix.includes("-") && prefix.length > 8)
|
|
37
80
|
return prefix;
|
|
@@ -99,25 +142,28 @@ function printMeetingTable(meetings) {
|
|
|
99
142
|
const id = m.meetingId.slice(0, 8);
|
|
100
143
|
const fullTitle = displayTitle(m);
|
|
101
144
|
const title = fullTitle.length > TITLE_W ? fullTitle.slice(0, TITLE_W - 1) + "…" : fullTitle;
|
|
102
|
-
const date =
|
|
145
|
+
const date = safeFormatDate(m.startTime, {
|
|
103
146
|
month: "short",
|
|
104
147
|
day: "numeric",
|
|
105
148
|
hour: "2-digit",
|
|
106
149
|
minute: "2-digit",
|
|
107
150
|
});
|
|
108
|
-
const dur =
|
|
151
|
+
const dur = safeFormatDuration(m.duration);
|
|
152
|
+
const status = m.status ? statusBadge(m.status) : chalk.dim("-");
|
|
153
|
+
const parts = typeof m.participantCount === "number" ? String(m.participantCount) : "-";
|
|
109
154
|
const flags = [
|
|
110
155
|
m.hasTranscript ? "T" : "",
|
|
111
156
|
m.hasNotes ? "N" : "",
|
|
157
|
+
m.hasSignals ? "S" : "",
|
|
112
158
|
].filter(Boolean).join("") || "-";
|
|
113
159
|
console.log([
|
|
114
160
|
chalk.cyan(id.padEnd(ID_W)),
|
|
115
161
|
title.padEnd(TITLE_W),
|
|
116
162
|
chalk.dim(date.padEnd(DATE_W)),
|
|
117
163
|
dur.padEnd(DUR_W),
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
flags,
|
|
164
|
+
status.padEnd(STATUS_W + 10), // chalk adds escape chars
|
|
165
|
+
parts.padEnd(PARTS_W),
|
|
166
|
+
flags.padEnd(FLAGS_W),
|
|
121
167
|
].join(" "));
|
|
122
168
|
}
|
|
123
169
|
}
|
|
@@ -188,16 +234,34 @@ export function registerMeetingsCommand(program) {
|
|
|
188
234
|
console.log(JSON.stringify(detail, null, 2));
|
|
189
235
|
return;
|
|
190
236
|
}
|
|
191
|
-
|
|
237
|
+
if (isMarkdownShape(detail)) {
|
|
238
|
+
const fm = detail.source.frontmatter ?? {};
|
|
239
|
+
console.log(chalk.bold(`\n${fm.title || "(untitled)"}\n`));
|
|
240
|
+
console.log(` ID: ${chalk.cyan(detail.meetingId)}`);
|
|
241
|
+
console.log(` Status: ${fm.bot_status || "-"}`);
|
|
242
|
+
console.log(` Date: ${safeFormatDate(fm.scheduled_start_time || fm.created_at)}`);
|
|
243
|
+
console.log(` Platform: ${fm.meeting_platform || "-"}`);
|
|
244
|
+
console.log(` Origin: ${fm.origin || "-"}`);
|
|
245
|
+
console.log(` Company: ${fm.company_id || "-"}`);
|
|
246
|
+
if (fm.meeting_url)
|
|
247
|
+
console.log(` Meeting URL: ${fm.meeting_url}`);
|
|
248
|
+
if (hasSignals(detail.signals)) {
|
|
249
|
+
console.log(` Signals: ${Object.keys(detail.signals).length}`);
|
|
250
|
+
}
|
|
251
|
+
console.log(chalk.dim(`\n This meeting is stored as a markdown document. Use \`hq meetings transcript ${detail.meetingId.slice(0, 8)}\` to view the full document.`));
|
|
252
|
+
console.log();
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
console.log(chalk.bold(`\n${detail.title ?? "(untitled)"}\n`));
|
|
192
256
|
console.log(` ID: ${chalk.cyan(detail.meetingId)}`);
|
|
193
|
-
console.log(` Status: ${statusBadge(detail.status)}`);
|
|
194
|
-
console.log(` Date: ${
|
|
195
|
-
console.log(` Duration: ${
|
|
196
|
-
console.log(` Source: ${detail.sourceApp} (${detail.botProvider})`);
|
|
257
|
+
console.log(` Status: ${detail.status ? statusBadge(detail.status) : chalk.dim("-")}`);
|
|
258
|
+
console.log(` Date: ${safeFormatDate(detail.startTime)}`);
|
|
259
|
+
console.log(` Duration: ${safeFormatDuration(detail.duration)}`);
|
|
260
|
+
console.log(` Source: ${detail.sourceApp ?? "-"} (${detail.botProvider ?? "-"})`);
|
|
197
261
|
console.log(` Shared: ${detail.isShared ? "yes" : "no"}`);
|
|
198
|
-
if (detail.participants
|
|
262
|
+
if ((detail.participants?.length ?? 0) > 0) {
|
|
199
263
|
console.log(chalk.bold("\n Participants:"));
|
|
200
|
-
for (const p of detail.participants) {
|
|
264
|
+
for (const p of detail.participants ?? []) {
|
|
201
265
|
const name = p.name ?? p.email;
|
|
202
266
|
const role = p.role === "organizer" ? chalk.yellow(" (organizer)") : "";
|
|
203
267
|
console.log(` - ${name}${role}`);
|
|
@@ -325,6 +389,26 @@ export function registerMeetingsCommand(program) {
|
|
|
325
389
|
if (!res.ok)
|
|
326
390
|
await handleApiError(res);
|
|
327
391
|
const detail = (await res.json());
|
|
392
|
+
if (isMarkdownShape(detail)) {
|
|
393
|
+
const documentUrl = detail.source.presigned_url;
|
|
394
|
+
if (!documentUrl) {
|
|
395
|
+
console.error(chalk.red("No document available for this meeting."));
|
|
396
|
+
process.exit(1);
|
|
397
|
+
}
|
|
398
|
+
const docRes = await fetch(documentUrl);
|
|
399
|
+
if (!docRes.ok) {
|
|
400
|
+
console.error(chalk.red(`Failed to download meeting document (${docRes.status})`));
|
|
401
|
+
process.exit(1);
|
|
402
|
+
}
|
|
403
|
+
const markdown = await docRes.text();
|
|
404
|
+
if (meetings.opts().json) {
|
|
405
|
+
console.log(JSON.stringify({ meetingId: detail.meetingId, sourceShape: "markdown", markdown }, null, 2));
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
console.log(chalk.bold(`\nTranscript: ${detail.source.frontmatter?.title || "(untitled)"}\n`));
|
|
409
|
+
console.log(markdown);
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
328
412
|
if (!detail.documentUrl) {
|
|
329
413
|
console.error(chalk.red("No document URL available for this meeting."));
|
|
330
414
|
process.exit(1);
|
|
@@ -375,6 +459,35 @@ export function registerMeetingsCommand(program) {
|
|
|
375
459
|
if (!res.ok)
|
|
376
460
|
await handleApiError(res);
|
|
377
461
|
const detail = (await res.json());
|
|
462
|
+
if (isMarkdownShape(detail)) {
|
|
463
|
+
if (hasSignals(detail.signals)) {
|
|
464
|
+
if (meetings.opts().json) {
|
|
465
|
+
console.log(JSON.stringify(detail.signals, null, 2));
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
console.log(chalk.bold(`\nMeeting Notes: ${detail.source.frontmatter?.title || "(untitled)"}\n`));
|
|
469
|
+
renderSignals(detail.signals);
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
const documentUrl = detail.source.presigned_url;
|
|
473
|
+
if (!documentUrl) {
|
|
474
|
+
console.log(chalk.yellow("No notes available for this meeting."));
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
const docRes = await fetch(documentUrl);
|
|
478
|
+
if (!docRes.ok) {
|
|
479
|
+
console.error(chalk.red(`Failed to download meeting document (${docRes.status})`));
|
|
480
|
+
process.exit(1);
|
|
481
|
+
}
|
|
482
|
+
const markdown = await docRes.text();
|
|
483
|
+
if (meetings.opts().json) {
|
|
484
|
+
console.log(JSON.stringify({ meetingId: detail.meetingId, sourceShape: "markdown", markdown }, null, 2));
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
console.log(chalk.bold(`\nMeeting Notes: ${detail.source.frontmatter?.title || "(untitled)"}\n`));
|
|
488
|
+
console.log(markdown);
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
378
491
|
if (!detail.documentUrl) {
|
|
379
492
|
console.error(chalk.red("No document URL available for this meeting."));
|
|
380
493
|
process.exit(1);
|
|
@@ -437,4 +550,4 @@ export function registerMeetingsCommand(program) {
|
|
|
437
550
|
});
|
|
438
551
|
}
|
|
439
552
|
//# sourceMappingURL=meetings.js.map
|
|
440
|
-
//# debugId=
|
|
553
|
+
//# debugId=6bb33e65-134a-5b0a-917b-ca084d4c8366
|
package/dist/commands/secrets.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="3b78d543-70d6-52e2-b19f-fa2650534e97")}catch(e){}}();
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
import * as readline from "node:readline";
|
|
5
5
|
import { spawn } from "node:child_process";
|
|
@@ -218,7 +218,11 @@ export function scrubSandboxOutput(text, secretNames = []) {
|
|
|
218
218
|
}
|
|
219
219
|
function renderSandboxJobResult(job, secretNames) {
|
|
220
220
|
if (job.output) {
|
|
221
|
-
|
|
221
|
+
const output = scrubSandboxOutput(job.output, secretNames);
|
|
222
|
+
process.stdout.write(output);
|
|
223
|
+
if (output.length > 0 && !output.endsWith("\n")) {
|
|
224
|
+
process.stdout.write("\n");
|
|
225
|
+
}
|
|
222
226
|
}
|
|
223
227
|
}
|
|
224
228
|
function normalizePolicyRecord(secretPath, data) {
|
|
@@ -1254,4 +1258,4 @@ export function registerSecretsCommand(program) {
|
|
|
1254
1258
|
});
|
|
1255
1259
|
}
|
|
1256
1260
|
//# sourceMappingURL=secrets.js.map
|
|
1257
|
-
//# debugId=
|
|
1261
|
+
//# debugId=3b78d543-70d6-52e2-b19f-fa2650534e97
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// MUST be first: guard the Node version before any dependency that needs a
|
|
6
6
|
// Node 20+ API (e.g. util.styleText) or a newer native ABI is evaluated.
|
|
7
7
|
|
|
8
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
8
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="8839ee7d-9f6d-54fe-8f90-99ad858e349e")}catch(e){}}();
|
|
9
9
|
import "./node-preflight.js";
|
|
10
10
|
import { Command } from "commander";
|
|
11
11
|
import { initSentry, Sentry } from "./sentry.js";
|
|
@@ -41,6 +41,7 @@ import { registerFilesBrowseCommands } from "./commands/files-browse.js";
|
|
|
41
41
|
import { registerMembersCommand } from "./commands/members.js";
|
|
42
42
|
import { registerPeopleCommand } from "./commands/people.js";
|
|
43
43
|
import { registerDmCommand } from "./commands/dm.js";
|
|
44
|
+
import { registerChannelsCommand } from "./commands/channels.js";
|
|
44
45
|
import { registerFeedbackCommand } from "./commands/feedback.js";
|
|
45
46
|
import { registerMeetingsCommand } from "./commands/meetings.js";
|
|
46
47
|
import { registerSourcesCommand } from "./commands/sources.js";
|
|
@@ -152,6 +153,7 @@ registerMembersCommand(program);
|
|
|
152
153
|
// the local companies/<co>/people store scoped to one company.
|
|
153
154
|
registerPeopleCommand(program);
|
|
154
155
|
registerDmCommand(program);
|
|
156
|
+
registerChannelsCommand(program);
|
|
155
157
|
// Onboarding (top-level — Cognito + vault-service provisioning)
|
|
156
158
|
registerOnboardCommand(program);
|
|
157
159
|
// Feedback (subcommand group — hq feedback bug|feature)
|
|
@@ -242,4 +244,4 @@ registerCompanyCommand(program);
|
|
|
242
244
|
}
|
|
243
245
|
})();
|
|
244
246
|
//# sourceMappingURL=index.js.map
|
|
245
|
-
//# debugId=
|
|
247
|
+
//# debugId=8839ee7d-9f6d-54fe-8f90-99ad858e349e
|