@indigoai-us/hq-cli 5.77.13 → 5.78.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/CHANGELOG.md +34 -0
- package/assets/scaffold/core/scripts/archive-old-threads.sh +86 -0
- package/assets/scaffold/core/scripts/backfill-company-skill-mirrors.sh +73 -0
- package/assets/scaffold/core/scripts/backfill-workspace-mirror.sh +51 -0
- package/assets/scaffold/core/scripts/codex-skill-bridge.sh +550 -0
- package/assets/scaffold/core/scripts/detect-stale-core-policy-mirror.sh +185 -0
- package/assets/scaffold/core/scripts/hq-status-summary.sh +187 -0
- package/assets/scaffold/core/scripts/ontology-readme-drift.sh +264 -0
- package/assets/scaffold/core/scripts/qmd-reindex-after-sync.sh +93 -0
- package/assets/scaffold/core/scripts/rebuild-all-indexes.sh +69 -0
- package/assets/scaffold/core/scripts/rebuild-companies-index.sh +206 -0
- package/assets/scaffold/core/scripts/rebuild-company-knowledge-index.sh +127 -0
- package/assets/scaffold/core/scripts/rebuild-orchestrator-index.sh +86 -0
- package/assets/scaffold/core/scripts/rebuild-projects-index.sh +105 -0
- package/assets/scaffold/core/scripts/rebuild-public-knowledge-index.sh +83 -0
- package/assets/scaffold/core/scripts/rebuild-reports-index.sh +114 -0
- package/assets/scaffold/core/scripts/rebuild-social-drafts-index.sh +135 -0
- package/assets/scaffold/core/scripts/rebuild-threads-index.sh +82 -0
- package/assets/scaffold/core/scripts/rebuild-workers-index.sh +97 -0
- package/assets/scaffold/core/scripts/resize-screenshot.sh +47 -0
- package/assets/scaffold/core/scripts/token-usage-report.sh +254 -0
- package/assets/scaffold/core/scripts/worktree.sh +136 -0
- package/dist/commands/agents.js +28 -12
- package/dist/commands/api-keys.js +100 -20
- package/dist/commands/core.d.ts +90 -0
- package/dist/commands/core.js +279 -0
- package/dist/commands/files-browse.d.ts +21 -0
- package/dist/commands/files-browse.js +145 -24
- package/dist/commands/files.js +33 -7
- package/dist/commands/members.js +16 -5
- package/dist/commands/pack-install.d.ts +14 -0
- package/dist/commands/pack-install.js +51 -2
- package/dist/commands/pkg-install.js +43 -0
- package/dist/commands/run.js +8 -0
- package/dist/commands/secrets.js +125 -65
- package/dist/main.js +6 -0
- package/dist/utils/api-key-command-gate.d.ts +45 -0
- package/dist/utils/api-key-command-gate.js +51 -0
- package/dist/utils/hq-roots.d.ts +91 -0
- package/dist/utils/hq-roots.js +212 -0
- package/dist/utils/resolve-vault-credential.d.ts +63 -3
- package/dist/utils/resolve-vault-credential.js +152 -6
- package/dist/utils/run-bundled-script.d.ts +66 -0
- package/dist/utils/run-bundled-script.js +80 -0
- package/dist/utils/vault-api.d.ts +21 -0
- package/dist/utils/vault-api.js +74 -3
- package/package.json +7 -1
- package/.claude/policies/hq-cli-interactive-reads-use-sts-vend.md +0 -49
- package/.github/workflows/ci.yml +0 -46
- package/.github/workflows/publish.yml +0 -36
- package/.github/workflows/scripts/smoke-test-pkg.sh +0 -97
- package/e2e/cli.test.ts +0 -128
- package/eslint.config.js +0 -37
- package/pnpm-workspace.yaml +0 -4
- package/scripts/chmod-bins.mjs +0 -49
- package/scripts/generate-dsn.mjs +0 -26
- package/scripts/generate-scan-packages-table.mjs +0 -113
- package/scripts/smoke-sources-signals.sh +0 -103
- package/src/bin/hq-auth-refresh.ts +0 -43
- package/src/cli-version.ts +0 -13
- package/src/commands/__fixtures__/make-tar.ts +0 -126
- package/src/commands/_patterns.ts +0 -10
- package/src/commands/add.ts +0 -75
- package/src/commands/agents.test.ts +0 -527
- package/src/commands/agents.ts +0 -923
- package/src/commands/api-keys.test.ts +0 -291
- package/src/commands/api-keys.ts +0 -382
- package/src/commands/artifact-verify.test.ts +0 -177
- package/src/commands/auth.test.ts +0 -82
- package/src/commands/auth.ts +0 -213
- package/src/commands/billing.test.ts +0 -158
- package/src/commands/billing.ts +0 -146
- package/src/commands/channels.test.ts +0 -74
- package/src/commands/channels.ts +0 -91
- package/src/commands/cloud-demote.test.ts +0 -401
- package/src/commands/cloud-demote.ts +0 -278
- package/src/commands/cloud-provision.test.ts +0 -1117
- package/src/commands/cloud-provision.ts +0 -942
- package/src/commands/cloud.pull-all.test.ts +0 -711
- package/src/commands/cloud.pull-per-company.test.ts +0 -188
- package/src/commands/cloud.push-all.test.ts +0 -485
- package/src/commands/cloud.scope-excluded-warning.test.ts +0 -22
- package/src/commands/cloud.selectors.test.ts +0 -208
- package/src/commands/cloud.status.test.ts +0 -160
- package/src/commands/cloud.test.ts +0 -41
- package/src/commands/cloud.ts +0 -2130
- package/src/commands/company.test.ts +0 -202
- package/src/commands/company.ts +0 -148
- package/src/commands/creators.test.ts +0 -60
- package/src/commands/creators.ts +0 -117
- package/src/commands/crm.test.ts +0 -179
- package/src/commands/crm.ts +0 -236
- package/src/commands/db-migrate.ts +0 -55
- package/src/commands/db-provision.ts +0 -114
- package/src/commands/db-sql.ts +0 -124
- package/src/commands/db-status.ts +0 -108
- package/src/commands/db.ts +0 -26
- package/src/commands/dm.test.ts +0 -748
- package/src/commands/dm.ts +0 -1226
- package/src/commands/feedback.test.ts +0 -413
- package/src/commands/feedback.ts +0 -169
- package/src/commands/files-browse.test.ts +0 -1249
- package/src/commands/files-browse.ts +0 -1506
- package/src/commands/files-delete.test.ts +0 -484
- package/src/commands/files-recovery.test.ts +0 -370
- package/src/commands/files.test.ts +0 -722
- package/src/commands/files.ts +0 -1446
- package/src/commands/group-grants.test.ts +0 -330
- package/src/commands/group-grants.ts +0 -455
- package/src/commands/groups.test.ts +0 -44
- package/src/commands/groups.ts +0 -368
- package/src/commands/integrations.test.ts +0 -633
- package/src/commands/integrations.ts +0 -507
- package/src/commands/list.ts +0 -85
- package/src/commands/login.ts +0 -52
- package/src/commands/logout.ts +0 -30
- package/src/commands/marketplace-install.test.ts +0 -543
- package/src/commands/marketplace-security.test.ts +0 -646
- package/src/commands/mcp-registration.test.ts +0 -2787
- package/src/commands/mcp-registration.ts +0 -2612
- package/src/commands/mcp-status.test.ts +0 -483
- package/src/commands/mcp-status.ts +0 -575
- package/src/commands/mcp-status.us011.test.ts +0 -243
- package/src/commands/meetings.test.ts +0 -522
- package/src/commands/meetings.ts +0 -789
- package/src/commands/members.test.ts +0 -1474
- package/src/commands/members.ts +0 -1181
- package/src/commands/onboard-identity-guard.test.ts +0 -99
- package/src/commands/onboard-identity-guard.ts +0 -103
- package/src/commands/onboard-join.test.ts +0 -96
- package/src/commands/onboard-join.ts +0 -101
- package/src/commands/onboard-warning.test.ts +0 -26
- package/src/commands/onboard-warning.ts +0 -12
- package/src/commands/onboard.ts +0 -267
- package/src/commands/outposts-heartbeat.test.ts +0 -299
- package/src/commands/outposts-heartbeat.ts +0 -310
- package/src/commands/outposts-replica-sync.test.ts +0 -272
- package/src/commands/outposts-self-deploy.test.ts +0 -243
- package/src/commands/outposts.test.ts +0 -1039
- package/src/commands/outposts.ts +0 -1935
- package/src/commands/pack-install-secret-authorization.test.ts +0 -115
- package/src/commands/pack-install.test.ts +0 -1469
- package/src/commands/pack-install.ts +0 -2247
- package/src/commands/pack-update-cache.test.ts +0 -149
- package/src/commands/packs.test.ts +0 -88
- package/src/commands/packs.ts +0 -622
- package/src/commands/people.test.ts +0 -807
- package/src/commands/people.ts +0 -422
- package/src/commands/pkg-install.dispatch.test.ts +0 -71
- package/src/commands/pkg-install.ts +0 -215
- package/src/commands/pkg-list.test.ts +0 -79
- package/src/commands/pkg-list.ts +0 -13
- package/src/commands/pkg-remove.ts +0 -71
- package/src/commands/pkg-update.ts +0 -189
- package/src/commands/publish.test.ts +0 -650
- package/src/commands/publish.ts +0 -580
- package/src/commands/reindex.test.ts +0 -259
- package/src/commands/reindex.ts +0 -274
- package/src/commands/rescue.test.ts +0 -39
- package/src/commands/rescue.ts +0 -210
- package/src/commands/run.env-local.test.ts +0 -88
- package/src/commands/run.test.ts +0 -45
- package/src/commands/run.ts +0 -184
- package/src/commands/safe-extract.test.ts +0 -459
- package/src/commands/safe-extract.ts +0 -444
- package/src/commands/secrets-scope.test.ts +0 -56
- package/src/commands/secrets-scope.ts +0 -32
- package/src/commands/secrets.parse-destination.test.ts +0 -38
- package/src/commands/secrets.test.ts +0 -2037
- package/src/commands/secrets.ts +0 -2240
- package/src/commands/signals.ts +0 -351
- package/src/commands/skill.test.ts +0 -770
- package/src/commands/skill.ts +0 -796
- package/src/commands/sources.ts +0 -362
- package/src/commands/sync-mode.test.ts +0 -366
- package/src/commands/sync-mode.ts +0 -387
- package/src/commands/sync-narrow.test.ts +0 -633
- package/src/commands/sync-narrow.ts +0 -555
- package/src/commands/sync.ts +0 -165
- package/src/commands/team-sync.ts +0 -628
- package/src/commands/update.ts +0 -71
- package/src/commands/whoami.ts +0 -83
- package/src/commands/workers.test.ts +0 -158
- package/src/commands/workers.ts +0 -301
- package/src/index.test.ts +0 -32
- package/src/index.ts +0 -20
- package/src/lib/db/control-plane.test.ts +0 -59
- package/src/lib/db/control-plane.ts +0 -113
- package/src/lib/db/local.test.ts +0 -81
- package/src/lib/db/local.ts +0 -148
- package/src/lib/db/migrate.test.ts +0 -133
- package/src/lib/db/migrate.ts +0 -137
- package/src/lib/db/paths.test.ts +0 -112
- package/src/lib/db/paths.ts +0 -128
- package/src/lib/db/remote-engine.test.ts +0 -44
- package/src/lib/db/remote-engine.ts +0 -148
- package/src/lib/db/remote-sql.test.ts +0 -32
- package/src/lib/db/remote-sql.ts +0 -62
- package/src/lib/db/sql.test.ts +0 -106
- package/src/lib/db/sql.ts +0 -192
- package/src/lib/hq-cloud-dep.smoke.test.ts +0 -75
- package/src/lib/local-tree-diff.test.ts +0 -301
- package/src/lib/local-tree-diff.ts +0 -362
- package/src/lib/narrow-hint-banner.test.ts +0 -235
- package/src/lib/narrow-hint-banner.ts +0 -212
- package/src/lib/plan-limit-nag.test.ts +0 -317
- package/src/lib/plan-limit-nag.ts +0 -264
- package/src/main.ts +0 -371
- package/src/node-preflight.test.ts +0 -60
- package/src/node-preflight.ts +0 -67
- package/src/outpost/session-heartbeat-bounds.test.ts +0 -195
- package/src/outpost/session-heartbeat-guard.test.ts +0 -105
- package/src/outpost/session-heartbeat-publisher.test.ts +0 -178
- package/src/outpost/session-heartbeat-publisher.ts +0 -186
- package/src/outpost/session-heartbeat-retain-guard.test.ts +0 -126
- package/src/outpost/session-heartbeat.test.ts +0 -459
- package/src/outpost/session-heartbeat.ts +0 -877
- package/src/packaging.test.ts +0 -109
- package/src/run/__fixtures__/discover-schemas/example.env.schema +0 -4
- package/src/run/discover-schemas.test.ts +0 -153
- package/src/run/discover-schemas.ts +0 -79
- package/src/run/hq-plugin.test.ts +0 -371
- package/src/run/hq-plugin.ts +0 -277
- package/src/run/varlock-shape.test.ts +0 -57
- package/src/schemas/hq-package.schema.json +0 -155
- package/src/sentry-before-send.test.ts +0 -359
- package/src/sentry-before-send.ts +0 -221
- package/src/sentry-epipe.test.ts +0 -37
- package/src/sentry-release.test.ts +0 -54
- package/src/sentry.test.ts +0 -24
- package/src/sentry.ts +0 -54
- package/src/strategies/link.ts +0 -62
- package/src/strategies/merge.ts +0 -142
- package/src/types.ts +0 -146
- package/src/utils/__fixtures__/scan-packages.generated-block.sh +0 -23
- package/src/utils/auth-error.test.ts +0 -40
- package/src/utils/auth-error.ts +0 -42
- package/src/utils/billing-gate.test.ts +0 -95
- package/src/utils/billing-gate.ts +0 -228
- package/src/utils/breadcrumb-buffer.ts +0 -18
- package/src/utils/cli-telemetry.test.ts +0 -153
- package/src/utils/cli-telemetry.ts +0 -61
- package/src/utils/cognito-session.machine.test.ts +0 -109
- package/src/utils/cognito-session.refresh.test.ts +0 -84
- package/src/utils/cognito-session.test.ts +0 -328
- package/src/utils/cognito-session.ts +0 -448
- package/src/utils/company-selection-error.test.ts +0 -42
- package/src/utils/company-selection-error.ts +0 -45
- package/src/utils/contribution-table.ts +0 -83
- package/src/utils/environmental-error.test.ts +0 -45
- package/src/utils/environmental-error.ts +0 -39
- package/src/utils/epipe.test.ts +0 -28
- package/src/utils/epipe.ts +0 -29
- package/src/utils/expected-cli-error.test.ts +0 -28
- package/src/utils/expected-cli-error.ts +0 -39
- package/src/utils/feedback-diagnostics.test.ts +0 -183
- package/src/utils/feedback-diagnostics.ts +0 -123
- package/src/utils/feedback-screenshots.test.ts +0 -134
- package/src/utils/feedback-screenshots.ts +0 -124
- package/src/utils/feedback-versions.test.ts +0 -98
- package/src/utils/feedback-versions.ts +0 -68
- package/src/utils/git.ts +0 -74
- package/src/utils/integrity.ts +0 -59
- package/src/utils/intercepted-process-exit.test.ts +0 -37
- package/src/utils/intercepted-process-exit.ts +0 -36
- package/src/utils/login-provider.test.ts +0 -42
- package/src/utils/login-provider.ts +0 -30
- package/src/utils/manifest.test.ts +0 -167
- package/src/utils/manifest.ts +0 -131
- package/src/utils/pack-contributions.test.ts +0 -603
- package/src/utils/pack-contributions.ts +0 -450
- package/src/utils/people.ts +0 -215
- package/src/utils/registry-client.ts +0 -204
- package/src/utils/registry.ts +0 -90
- package/src/utils/resolve-vault-credential.test.ts +0 -69
- package/src/utils/resolve-vault-credential.ts +0 -60
- package/src/utils/sandbox-runner-client.test.ts +0 -279
- package/src/utils/sandbox-runner-client.ts +0 -260
- package/src/utils/secrets-cache.ts +0 -183
- package/src/utils/sentry-identity.ts +0 -45
- package/src/utils/settle-with-timeout.test.ts +0 -21
- package/src/utils/settle-with-timeout.ts +0 -22
- package/src/utils/user-yaml-error.test.ts +0 -24
- package/src/utils/user-yaml-error.ts +0 -30
- package/src/utils/vault-api.test.ts +0 -536
- package/src/utils/vault-api.ts +0 -382
- package/src/utils/version-check.test.ts +0 -176
- package/src/utils/version-check.ts +0 -155
- package/src/utils/version-gate.test.ts +0 -1024
- package/src/utils/version-gate.ts +0 -702
- package/test/commands/db-tenant-isolation.test.ts +0 -94
- package/test/commands/db.test.ts +0 -85
- package/test/commands/signals.test.ts +0 -207
- package/test/commands/sources.test.ts +0 -231
- package/test/e2e/smoke-install-mcp.sh +0 -113
- package/test/fixtures/hq-pack-smoke-mcp/mcp/smoke-http.json +0 -1
- package/test/fixtures/hq-pack-smoke-mcp/package.yaml +0 -11
- package/test/fixtures/signals/action_item/sample.md +0 -16
- package/test/fixtures/signals/summary/sample.md +0 -12
- package/test/fixtures/sources/meetings/sample.md +0 -25
- package/test/helpers/cli-runner.ts +0 -150
- package/test/helpers/s3-list-mock.ts +0 -79
- package/test/helpers/vault-service-mock.ts +0 -295
- package/test/sources-signals/smoke.test.ts +0 -228
- package/tsconfig.json +0 -20
- package/vitest.config.ts +0 -11
- package/vitest.e2e.config.ts +0 -7
|
@@ -1,522 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
import {
|
|
3
|
-
afterEach,
|
|
4
|
-
beforeEach,
|
|
5
|
-
describe,
|
|
6
|
-
expect,
|
|
7
|
-
it,
|
|
8
|
-
vi,
|
|
9
|
-
type MockInstance,
|
|
10
|
-
} from "vitest";
|
|
11
|
-
|
|
12
|
-
vi.mock("../utils/cognito-session.js", async (importOriginal) => {
|
|
13
|
-
const original = (await importOriginal()) as Record<string, unknown>;
|
|
14
|
-
return {
|
|
15
|
-
...original,
|
|
16
|
-
ensureCognitoToken: vi.fn(async () => "test-token"),
|
|
17
|
-
};
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
vi.mock("../utils/vault-api.js", async (importOriginal) => {
|
|
21
|
-
const original = (await importOriginal()) as Record<string, unknown>;
|
|
22
|
-
return {
|
|
23
|
-
...original,
|
|
24
|
-
getCompanyUid: vi.fn(async (_token: string, slug: string) => `cmp_${slug}`),
|
|
25
|
-
vaultApiFetch: vi.fn(async () =>
|
|
26
|
-
new Response(JSON.stringify({ appliedToSeries: true }), {
|
|
27
|
-
status: 200,
|
|
28
|
-
headers: { "Content-Type": "application/json" },
|
|
29
|
-
}),
|
|
30
|
-
),
|
|
31
|
-
};
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
import { registerMeetingsCommand } from "./meetings.js";
|
|
35
|
-
import { ensureCognitoToken } from "../utils/cognito-session.js";
|
|
36
|
-
import { getCompanyUid, vaultApiFetch } from "../utils/vault-api.js";
|
|
37
|
-
|
|
38
|
-
let logSpy: MockInstance<typeof console.log>;
|
|
39
|
-
let errSpy: MockInstance<typeof console.error>;
|
|
40
|
-
|
|
41
|
-
beforeEach(() => {
|
|
42
|
-
vi.clearAllMocks();
|
|
43
|
-
logSpy = vi.spyOn(console, "log").mockImplementation(() => undefined);
|
|
44
|
-
errSpy = vi.spyOn(console, "error").mockImplementation(() => undefined);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
afterEach(() => {
|
|
48
|
-
vi.restoreAllMocks();
|
|
49
|
-
vi.unstubAllGlobals();
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
function buildProgram(): Command {
|
|
53
|
-
const program = new Command();
|
|
54
|
-
program.exitOverride();
|
|
55
|
-
program.configureOutput({
|
|
56
|
-
writeOut: () => undefined,
|
|
57
|
-
writeErr: () => undefined,
|
|
58
|
-
});
|
|
59
|
-
registerMeetingsCommand(program);
|
|
60
|
-
return program;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function jsonRes(body: unknown, status = 200): Response {
|
|
64
|
-
return new Response(JSON.stringify(body), {
|
|
65
|
-
status,
|
|
66
|
-
headers: { "Content-Type": "application/json" },
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
describe("meetings get — short id resolution", () => {
|
|
71
|
-
it("resolves an 8-char short id to the full id before calling the by-id endpoint", async () => {
|
|
72
|
-
const fullId = "589bfd78-aaaa-bbbb-cccc-1234567890ab";
|
|
73
|
-
vi.mocked(vaultApiFetch)
|
|
74
|
-
.mockResolvedValueOnce(
|
|
75
|
-
jsonRes({
|
|
76
|
-
meetings: [
|
|
77
|
-
{
|
|
78
|
-
meetingId: fullId,
|
|
79
|
-
title: "T",
|
|
80
|
-
status: "ready",
|
|
81
|
-
startTime: "2026-01-01T00:00:00Z",
|
|
82
|
-
endTime: "2026-01-01T00:00:00Z",
|
|
83
|
-
duration: 0,
|
|
84
|
-
participantCount: 0,
|
|
85
|
-
hasTranscript: false,
|
|
86
|
-
hasNotes: false,
|
|
87
|
-
},
|
|
88
|
-
],
|
|
89
|
-
}),
|
|
90
|
-
)
|
|
91
|
-
.mockResolvedValueOnce(
|
|
92
|
-
jsonRes({
|
|
93
|
-
meetingId: fullId,
|
|
94
|
-
title: "T",
|
|
95
|
-
startTime: "2026-01-01T00:00:00Z",
|
|
96
|
-
endTime: "2026-01-01T00:00:00Z",
|
|
97
|
-
duration: 0,
|
|
98
|
-
participants: [],
|
|
99
|
-
calendarEventId: null,
|
|
100
|
-
botProvider: "recall",
|
|
101
|
-
sourceApp: "calendar",
|
|
102
|
-
companyId: "cmp_acme",
|
|
103
|
-
status: "ready",
|
|
104
|
-
recallBotId: null,
|
|
105
|
-
isShared: false,
|
|
106
|
-
createdAt: "2026-01-01T00:00:00Z",
|
|
107
|
-
updatedAt: "2026-01-01T00:00:00Z",
|
|
108
|
-
documentUrl: "",
|
|
109
|
-
hasTranscript: false,
|
|
110
|
-
hasNotes: false,
|
|
111
|
-
}),
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
const program = buildProgram();
|
|
115
|
-
await program.parseAsync(["node", "hq", "meetings", "get", "589bfd78"]);
|
|
116
|
-
|
|
117
|
-
expect(vaultApiFetch).toHaveBeenNthCalledWith(1, {
|
|
118
|
-
token: "test-token",
|
|
119
|
-
path: "/v1/meetings",
|
|
120
|
-
query: { limit: "500" },
|
|
121
|
-
});
|
|
122
|
-
expect(vaultApiFetch).toHaveBeenNthCalledWith(2, {
|
|
123
|
-
token: "test-token",
|
|
124
|
-
path: `/v1/meetings/${fullId}`,
|
|
125
|
-
query: {},
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
it("errors and never sends the truncated id when the short id matches no meeting", async () => {
|
|
130
|
-
vi.spyOn(process, "exit").mockImplementation((() => {
|
|
131
|
-
throw new Error("process.exit");
|
|
132
|
-
}) as never);
|
|
133
|
-
vi.mocked(vaultApiFetch).mockResolvedValueOnce(jsonRes({ meetings: [] }));
|
|
134
|
-
|
|
135
|
-
const program = buildProgram();
|
|
136
|
-
await expect(
|
|
137
|
-
program.parseAsync(["node", "hq", "meetings", "get", "589bfd78"]),
|
|
138
|
-
).rejects.toThrow("process.exit");
|
|
139
|
-
|
|
140
|
-
expect(errSpy).toHaveBeenCalledWith(
|
|
141
|
-
expect.stringContaining("No meeting matches ID \"589bfd78\""),
|
|
142
|
-
);
|
|
143
|
-
expect(vaultApiFetch).not.toHaveBeenCalledWith(
|
|
144
|
-
expect.objectContaining({ path: "/v1/meetings/589bfd78" }),
|
|
145
|
-
);
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
describe("meetings invite", () => {
|
|
150
|
-
it("authenticates and posts the meeting URL with the optional company routing", async () => {
|
|
151
|
-
const meetingUrl = "https://meet.google.com/abc-defg-hij";
|
|
152
|
-
vi.mocked(vaultApiFetch).mockResolvedValueOnce(
|
|
153
|
-
jsonRes({
|
|
154
|
-
botId: "bot_123",
|
|
155
|
-
meetingUrl,
|
|
156
|
-
platform: "google_meet",
|
|
157
|
-
status: "scheduled",
|
|
158
|
-
}),
|
|
159
|
-
);
|
|
160
|
-
|
|
161
|
-
const program = buildProgram();
|
|
162
|
-
await program.parseAsync([
|
|
163
|
-
"node",
|
|
164
|
-
"hq",
|
|
165
|
-
"meetings",
|
|
166
|
-
"--company",
|
|
167
|
-
"indigo",
|
|
168
|
-
"invite",
|
|
169
|
-
meetingUrl,
|
|
170
|
-
]);
|
|
171
|
-
|
|
172
|
-
expect(ensureCognitoToken).toHaveBeenCalledOnce();
|
|
173
|
-
expect(getCompanyUid).toHaveBeenCalledWith("test-token", "indigo");
|
|
174
|
-
expect(vaultApiFetch).toHaveBeenCalledWith({
|
|
175
|
-
token: "test-token",
|
|
176
|
-
method: "POST",
|
|
177
|
-
path: "/v1/bot/invite",
|
|
178
|
-
query: { companyId: "cmp_indigo" },
|
|
179
|
-
body: { meetingUrl },
|
|
180
|
-
});
|
|
181
|
-
expect(logSpy).toHaveBeenCalledWith(expect.stringContaining("Meeting bot invited"));
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
it("omits company routing so the backend uses the caller's personal vault", async () => {
|
|
185
|
-
const meetingUrl = "https://zoom.us/j/123456789";
|
|
186
|
-
vi.mocked(vaultApiFetch).mockResolvedValueOnce(
|
|
187
|
-
jsonRes({ botId: "bot_123", meetingUrl, status: "scheduled" }),
|
|
188
|
-
);
|
|
189
|
-
|
|
190
|
-
const program = buildProgram();
|
|
191
|
-
await program.parseAsync(["node", "hq", "meetings", "invite", meetingUrl]);
|
|
192
|
-
|
|
193
|
-
expect(getCompanyUid).not.toHaveBeenCalled();
|
|
194
|
-
expect(vaultApiFetch).toHaveBeenCalledWith({
|
|
195
|
-
token: "test-token",
|
|
196
|
-
method: "POST",
|
|
197
|
-
path: "/v1/bot/invite",
|
|
198
|
-
query: {},
|
|
199
|
-
body: { meetingUrl },
|
|
200
|
-
});
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
describe("meetings set-company", () => {
|
|
205
|
-
it("POSTs the resolved company id and applies to the recurring series by default", async () => {
|
|
206
|
-
vi.mocked(vaultApiFetch).mockResolvedValueOnce(
|
|
207
|
-
jsonRes({ appliedToSeries: true }),
|
|
208
|
-
);
|
|
209
|
-
|
|
210
|
-
const program = buildProgram();
|
|
211
|
-
await program.parseAsync([
|
|
212
|
-
"node",
|
|
213
|
-
"hq",
|
|
214
|
-
"meetings",
|
|
215
|
-
"set-company",
|
|
216
|
-
"meeting-123456",
|
|
217
|
-
"--company",
|
|
218
|
-
"acme",
|
|
219
|
-
]);
|
|
220
|
-
|
|
221
|
-
expect(getCompanyUid).toHaveBeenCalledWith("test-token", "acme");
|
|
222
|
-
expect(vaultApiFetch).toHaveBeenCalledWith({
|
|
223
|
-
token: "test-token",
|
|
224
|
-
method: "POST",
|
|
225
|
-
path: "/v1/meetings/meeting-123456/company",
|
|
226
|
-
body: { companyId: "cmp_acme", applyToSeries: true },
|
|
227
|
-
});
|
|
228
|
-
expect(errSpy).not.toHaveBeenCalled();
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
it("sends unknown without resolving a target company", async () => {
|
|
232
|
-
vi.mocked(vaultApiFetch).mockResolvedValueOnce(
|
|
233
|
-
jsonRes({ appliedToSeries: true }),
|
|
234
|
-
);
|
|
235
|
-
|
|
236
|
-
const program = buildProgram();
|
|
237
|
-
await program.parseAsync([
|
|
238
|
-
"node",
|
|
239
|
-
"hq",
|
|
240
|
-
"meetings",
|
|
241
|
-
"set-company",
|
|
242
|
-
"meeting-123456",
|
|
243
|
-
"--company",
|
|
244
|
-
"unknown",
|
|
245
|
-
]);
|
|
246
|
-
|
|
247
|
-
expect(getCompanyUid).not.toHaveBeenCalled();
|
|
248
|
-
expect(vaultApiFetch).toHaveBeenCalledWith({
|
|
249
|
-
token: "test-token",
|
|
250
|
-
method: "POST",
|
|
251
|
-
path: "/v1/meetings/meeting-123456/company",
|
|
252
|
-
body: { companyId: "unknown", applyToSeries: true },
|
|
253
|
-
});
|
|
254
|
-
});
|
|
255
|
-
|
|
256
|
-
it("sends applyToSeries false when --no-series is passed", async () => {
|
|
257
|
-
vi.mocked(vaultApiFetch).mockResolvedValueOnce(
|
|
258
|
-
jsonRes({ appliedToSeries: false }),
|
|
259
|
-
);
|
|
260
|
-
|
|
261
|
-
const program = buildProgram();
|
|
262
|
-
await program.parseAsync([
|
|
263
|
-
"node",
|
|
264
|
-
"hq",
|
|
265
|
-
"meetings",
|
|
266
|
-
"set-company",
|
|
267
|
-
"meeting-123456",
|
|
268
|
-
"--company",
|
|
269
|
-
"acme",
|
|
270
|
-
"--no-series",
|
|
271
|
-
]);
|
|
272
|
-
|
|
273
|
-
expect(vaultApiFetch).toHaveBeenCalledWith({
|
|
274
|
-
token: "test-token",
|
|
275
|
-
method: "POST",
|
|
276
|
-
path: "/v1/meetings/meeting-123456/company",
|
|
277
|
-
body: { companyId: "cmp_acme", applyToSeries: false },
|
|
278
|
-
});
|
|
279
|
-
});
|
|
280
|
-
|
|
281
|
-
it("prints the raw response when --json is passed", async () => {
|
|
282
|
-
const body = { meetingId: "meeting-123456", companyId: "cmp_acme" };
|
|
283
|
-
vi.mocked(vaultApiFetch).mockResolvedValueOnce(jsonRes(body));
|
|
284
|
-
|
|
285
|
-
const program = buildProgram();
|
|
286
|
-
await program.parseAsync([
|
|
287
|
-
"node",
|
|
288
|
-
"hq",
|
|
289
|
-
"meetings",
|
|
290
|
-
"--json",
|
|
291
|
-
"set-company",
|
|
292
|
-
"meeting-123456",
|
|
293
|
-
"--company",
|
|
294
|
-
"acme",
|
|
295
|
-
]);
|
|
296
|
-
|
|
297
|
-
expect(logSpy).toHaveBeenCalledWith(JSON.stringify(body, null, 2));
|
|
298
|
-
});
|
|
299
|
-
|
|
300
|
-
it("prints recurring series and refiled transcript counts from the response", async () => {
|
|
301
|
-
vi.mocked(vaultApiFetch).mockResolvedValueOnce(
|
|
302
|
-
jsonRes({
|
|
303
|
-
ok: true,
|
|
304
|
-
meetingId: "meeting-123456",
|
|
305
|
-
companyId: "cmp_acme",
|
|
306
|
-
seriesKey: "series-123",
|
|
307
|
-
appliedToSeries: true,
|
|
308
|
-
occurrencesUpdated: 3,
|
|
309
|
-
refiled: true,
|
|
310
|
-
refiledCount: 2,
|
|
311
|
-
}),
|
|
312
|
-
);
|
|
313
|
-
|
|
314
|
-
const program = buildProgram();
|
|
315
|
-
await program.parseAsync([
|
|
316
|
-
"node",
|
|
317
|
-
"hq",
|
|
318
|
-
"meetings",
|
|
319
|
-
"set-company",
|
|
320
|
-
"meeting-123456",
|
|
321
|
-
"--company",
|
|
322
|
-
"acme",
|
|
323
|
-
]);
|
|
324
|
-
|
|
325
|
-
expect(logSpy).toHaveBeenCalledWith(
|
|
326
|
-
expect.stringContaining("Applied to 3 meetings in this recurring series"),
|
|
327
|
-
);
|
|
328
|
-
expect(logSpy).toHaveBeenCalledWith(
|
|
329
|
-
expect.stringContaining("Refiled 2 transcripts into the new company vault."),
|
|
330
|
-
);
|
|
331
|
-
});
|
|
332
|
-
|
|
333
|
-
it("does not print multi-meeting or refile copy for a single occurrence without refiles", async () => {
|
|
334
|
-
vi.mocked(vaultApiFetch).mockResolvedValueOnce(
|
|
335
|
-
jsonRes({
|
|
336
|
-
ok: true,
|
|
337
|
-
meetingId: "meeting-123456",
|
|
338
|
-
companyId: "cmp_acme",
|
|
339
|
-
seriesKey: null,
|
|
340
|
-
appliedToSeries: false,
|
|
341
|
-
occurrencesUpdated: 1,
|
|
342
|
-
refiled: false,
|
|
343
|
-
refiledCount: 0,
|
|
344
|
-
}),
|
|
345
|
-
);
|
|
346
|
-
|
|
347
|
-
const program = buildProgram();
|
|
348
|
-
await program.parseAsync([
|
|
349
|
-
"node",
|
|
350
|
-
"hq",
|
|
351
|
-
"meetings",
|
|
352
|
-
"set-company",
|
|
353
|
-
"meeting-123456",
|
|
354
|
-
"--company",
|
|
355
|
-
"acme",
|
|
356
|
-
]);
|
|
357
|
-
|
|
358
|
-
const output = logSpy.mock.calls.map(([line]) => (line === undefined ? "" : String(line))).join("\n");
|
|
359
|
-
expect(output).not.toContain("Applied to 1 meetings");
|
|
360
|
-
expect(output).not.toContain("Refiled 0 transcripts");
|
|
361
|
-
expect(output).not.toContain("Future occurrences of this recurring series will inherit this attribution.");
|
|
362
|
-
});
|
|
363
|
-
});
|
|
364
|
-
|
|
365
|
-
describe("meetings list — null-safe rendering", () => {
|
|
366
|
-
it("does not crash when a meeting has an undefined or null title", async () => {
|
|
367
|
-
// The API can return meetings with a missing/null title even though the
|
|
368
|
-
// type says string. This list previously crashed with
|
|
369
|
-
// "Cannot read properties of undefined (reading 'length')" after printing
|
|
370
|
-
// the header. Assert the command completes and renders a placeholder.
|
|
371
|
-
vi.mocked(vaultApiFetch).mockResolvedValueOnce(
|
|
372
|
-
jsonRes({
|
|
373
|
-
meetings: [
|
|
374
|
-
{
|
|
375
|
-
meetingId: "589bfd78-aaaa-bbbb-cccc-1234567890ab",
|
|
376
|
-
// title intentionally omitted (undefined)
|
|
377
|
-
status: "ready",
|
|
378
|
-
startTime: "2026-01-01T00:00:00Z",
|
|
379
|
-
endTime: "2026-01-01T00:30:00Z",
|
|
380
|
-
duration: 1800,
|
|
381
|
-
participantCount: 3,
|
|
382
|
-
hasTranscript: true,
|
|
383
|
-
hasNotes: false,
|
|
384
|
-
},
|
|
385
|
-
{
|
|
386
|
-
meetingId: "689bfd78-aaaa-bbbb-cccc-1234567890ab",
|
|
387
|
-
title: null,
|
|
388
|
-
status: "ready",
|
|
389
|
-
startTime: "2026-01-02T00:00:00Z",
|
|
390
|
-
endTime: "2026-01-02T00:30:00Z",
|
|
391
|
-
duration: 1800,
|
|
392
|
-
participantCount: 1,
|
|
393
|
-
hasTranscript: false,
|
|
394
|
-
hasNotes: true,
|
|
395
|
-
},
|
|
396
|
-
],
|
|
397
|
-
}),
|
|
398
|
-
);
|
|
399
|
-
|
|
400
|
-
const program = buildProgram();
|
|
401
|
-
await expect(
|
|
402
|
-
program.parseAsync(["node", "hq", "meetings", "list", "--company", "indigo"]),
|
|
403
|
-
).resolves.toBeDefined();
|
|
404
|
-
|
|
405
|
-
const printed = logSpy.mock.calls.map(([line]) => (line === undefined ? "" : String(line))).join("\n");
|
|
406
|
-
expect(printed).toContain("Meetings (2)");
|
|
407
|
-
expect(printed).toContain("(untitled)");
|
|
408
|
-
});
|
|
409
|
-
});
|
|
410
|
-
|
|
411
|
-
describe("meetings — markdown shape rendering", () => {
|
|
412
|
-
const markdownMeetingId = "589bfd78-aaaa-bbbb-cccc-1234567890ab";
|
|
413
|
-
const markdownUrl = "https://example.test/meeting.md";
|
|
414
|
-
|
|
415
|
-
function markdownDetail(signals: Record<string, unknown> = {}) {
|
|
416
|
-
return {
|
|
417
|
-
meetingId: markdownMeetingId,
|
|
418
|
-
sourceShape: "markdown",
|
|
419
|
-
source: {
|
|
420
|
-
path: "meetings/meeting.md",
|
|
421
|
-
presigned_url: markdownUrl,
|
|
422
|
-
frontmatter: {
|
|
423
|
-
title: "Markdown Standup",
|
|
424
|
-
channel: "eng",
|
|
425
|
-
origin: "recall",
|
|
426
|
-
company_id: "cmp_indigo",
|
|
427
|
-
meeting_url: "https://meet.example.test/standup",
|
|
428
|
-
meeting_platform: "google_meet",
|
|
429
|
-
calendar_event_id: null,
|
|
430
|
-
scheduled_start_time: "2026-02-03T15:30:00Z",
|
|
431
|
-
created_at: "2026-02-03T15:00:00Z",
|
|
432
|
-
updated_at: "2026-02-03T16:00:00Z",
|
|
433
|
-
ingested_at: "2026-02-03T16:05:00Z",
|
|
434
|
-
recall_bot_id: null,
|
|
435
|
-
bot_status: "done",
|
|
436
|
-
auto_scheduled: true,
|
|
437
|
-
},
|
|
438
|
-
},
|
|
439
|
-
signals,
|
|
440
|
-
};
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
it("lists markdown meetings without invalid legacy field output", async () => {
|
|
444
|
-
vi.mocked(vaultApiFetch).mockResolvedValueOnce(
|
|
445
|
-
jsonRes({
|
|
446
|
-
meetings: [
|
|
447
|
-
{
|
|
448
|
-
meetingId: markdownMeetingId,
|
|
449
|
-
sourceShape: "markdown",
|
|
450
|
-
title: "Markdown Standup",
|
|
451
|
-
startTime: "2026-02-03T15:30:00Z",
|
|
452
|
-
channel: "eng",
|
|
453
|
-
ingested_at: "2026-02-03T16:05:00Z",
|
|
454
|
-
hasSignals: true,
|
|
455
|
-
companyId: "cmp_indigo",
|
|
456
|
-
attributed: true,
|
|
457
|
-
},
|
|
458
|
-
],
|
|
459
|
-
}),
|
|
460
|
-
);
|
|
461
|
-
|
|
462
|
-
const program = buildProgram();
|
|
463
|
-
await program.parseAsync(["node", "hq", "meetings", "list"]);
|
|
464
|
-
|
|
465
|
-
const output = logSpy.mock.calls.map(([line]) => (line === undefined ? "" : String(line))).join("\n");
|
|
466
|
-
expect(output).toContain("Markdown Standup");
|
|
467
|
-
expect(output).toContain(" S ");
|
|
468
|
-
expect(output).not.toContain("NaN");
|
|
469
|
-
expect(output).not.toContain("undefined");
|
|
470
|
-
expect(output).not.toContain("Invalid Date");
|
|
471
|
-
});
|
|
472
|
-
|
|
473
|
-
it("gets markdown details from frontmatter without reading participants", async () => {
|
|
474
|
-
vi.mocked(vaultApiFetch).mockResolvedValueOnce(jsonRes(markdownDetail({ action_items: ["Ship fix"] })));
|
|
475
|
-
|
|
476
|
-
const program = buildProgram();
|
|
477
|
-
await expect(
|
|
478
|
-
program.parseAsync(["node", "hq", "meetings", "get", markdownMeetingId]),
|
|
479
|
-
).resolves.toBeDefined();
|
|
480
|
-
|
|
481
|
-
const output = logSpy.mock.calls.map(([line]) => (line === undefined ? "" : String(line))).join("\n");
|
|
482
|
-
expect(output).toContain("Markdown Standup");
|
|
483
|
-
expect(output).toContain("Status: done");
|
|
484
|
-
expect(output).toContain("Platform: google_meet");
|
|
485
|
-
expect(output).toContain("Origin: recall");
|
|
486
|
-
expect(output).toContain("Company: cmp_indigo");
|
|
487
|
-
expect(output).toContain("Meeting URL: https://meet.example.test/standup");
|
|
488
|
-
expect(output).toContain("Signals: 1");
|
|
489
|
-
expect(output).toContain("stored as a markdown document");
|
|
490
|
-
});
|
|
491
|
-
|
|
492
|
-
it("prints markdown transcript text from the presigned source URL", async () => {
|
|
493
|
-
vi.mocked(vaultApiFetch).mockResolvedValueOnce(jsonRes(markdownDetail()));
|
|
494
|
-
const fetchMock = vi.fn(async () => new Response("# Markdown transcript\n\nHello team."));
|
|
495
|
-
vi.stubGlobal("fetch", fetchMock);
|
|
496
|
-
|
|
497
|
-
const program = buildProgram();
|
|
498
|
-
await program.parseAsync(["node", "hq", "meetings", "transcript", markdownMeetingId]);
|
|
499
|
-
|
|
500
|
-
expect(fetchMock).toHaveBeenCalledWith(markdownUrl);
|
|
501
|
-
const output = logSpy.mock.calls.map(([line]) => (line === undefined ? "" : String(line))).join("\n");
|
|
502
|
-
expect(output).toContain("Transcript: Markdown Standup");
|
|
503
|
-
expect(output).toContain("# Markdown transcript");
|
|
504
|
-
expect(output).toContain("Hello team.");
|
|
505
|
-
});
|
|
506
|
-
|
|
507
|
-
it("falls back to the markdown document for notes when markdown signals are empty", async () => {
|
|
508
|
-
vi.mocked(vaultApiFetch).mockResolvedValueOnce(jsonRes(markdownDetail({})));
|
|
509
|
-
vi.stubGlobal("fetch", vi.fn(async () => new Response("# Notes\n\nFollow up next week.")));
|
|
510
|
-
|
|
511
|
-
const program = buildProgram();
|
|
512
|
-
await program.parseAsync(["node", "hq", "meetings", "notes", markdownMeetingId]);
|
|
513
|
-
|
|
514
|
-
const output = logSpy.mock.calls.map(([line]) => (line === undefined ? "" : String(line))).join("\n");
|
|
515
|
-
const errors = errSpy.mock.calls.map(([line]) => (line === undefined ? "" : String(line))).join("\n");
|
|
516
|
-
expect(output).toContain("Meeting Notes: Markdown Standup");
|
|
517
|
-
expect(output).toContain("# Notes");
|
|
518
|
-
expect(output).toContain("Follow up next week.");
|
|
519
|
-
expect(output).not.toContain("No document URL available");
|
|
520
|
-
expect(errors).not.toContain("No document URL available");
|
|
521
|
-
});
|
|
522
|
-
});
|