@indigoai-us/hq-cli 5.15.0 → 5.17.0-sources-rc.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/.github/workflows/ci.yml +8 -4
- package/.github/workflows/publish.yml +8 -3
- package/dist/cli-version.d.ts +1 -0
- package/dist/cli-version.js +3 -2
- package/dist/commands/cloud-provision.d.ts +25 -0
- package/dist/commands/cloud-provision.js +75 -9
- package/dist/commands/groups.js +6 -6
- package/dist/commands/meetings.js +8 -8
- package/dist/commands/members.d.ts +4 -2
- package/dist/commands/members.js +30 -14
- package/dist/commands/signals.d.ts +24 -0
- package/dist/commands/signals.js +240 -0
- package/dist/commands/sources.d.ts +22 -0
- package/dist/commands/sources.js +250 -0
- package/dist/index.js +8 -2
- package/dist/utils/cognito-session.d.ts +10 -1
- package/dist/utils/cognito-session.js +18 -3
- package/package.json +5 -4
- package/scripts/smoke-sources-signals.sh +103 -0
- package/src/cli-version.ts +5 -1
- package/src/commands/cloud-provision.test.ts +27 -2
- package/src/commands/cloud-provision.ts +122 -7
- package/src/commands/groups.ts +4 -4
- package/src/commands/meetings.ts +6 -6
- package/src/commands/members.test.ts +56 -0
- package/src/commands/members.ts +44 -13
- package/src/commands/signals.ts +345 -0
- package/src/commands/sources.ts +356 -0
- package/src/index.ts +8 -0
- package/src/utils/cognito-session.test.ts +24 -1
- package/src/utils/cognito-session.ts +18 -0
- package/test/commands/signals.test.ts +200 -0
- package/test/commands/sources.test.ts +225 -0
- package/test/fixtures/signals/action_item/sample.md +16 -0
- package/test/fixtures/signals/summary/sample.md +12 -0
- package/test/fixtures/sources/meetings/sample.md +25 -0
- package/test/helpers/cli-runner.ts +150 -0
- package/test/helpers/s3-list-mock.ts +79 -0
- package/test/helpers/vault-service-mock.ts +160 -0
- package/test/sources-signals/smoke.test.ts +226 -0
- package/vitest.config.ts +11 -0
package/src/index.ts
CHANGED
|
@@ -30,6 +30,8 @@ import { registerFilesCommand } from "./commands/files.js";
|
|
|
30
30
|
import { registerMembersCommand } from "./commands/members.js";
|
|
31
31
|
import { registerFeedbackCommand } from "./commands/feedback.js";
|
|
32
32
|
import { registerMeetingsCommand } from "./commands/meetings.js";
|
|
33
|
+
import { registerSourcesCommand } from "./commands/sources.js";
|
|
34
|
+
import { registerSignalsCommand } from "./commands/signals.js";
|
|
33
35
|
import { sanitizeArgv } from "./utils/feedback-diagnostics.js";
|
|
34
36
|
import {
|
|
35
37
|
maybeWarnNewVersion,
|
|
@@ -134,6 +136,12 @@ registerFeedbackCommand(program);
|
|
|
134
136
|
// Meetings (subcommand group — hq meetings list|get|search|transcript|notes)
|
|
135
137
|
registerMeetingsCommand(program);
|
|
136
138
|
|
|
139
|
+
// Sources read surface (subcommand group — hq sources list|get|channels|entities)
|
|
140
|
+
registerSourcesCommand(program);
|
|
141
|
+
|
|
142
|
+
// Signals read surface (subcommand group — hq signals list|get|types|entities)
|
|
143
|
+
registerSignalsCommand(program);
|
|
144
|
+
|
|
137
145
|
(async () => {
|
|
138
146
|
try {
|
|
139
147
|
Sentry.addBreadcrumb({
|
|
@@ -8,7 +8,12 @@ import { mkdtempSync, rmSync, writeFileSync, mkdirSync } from "node:fs";
|
|
|
8
8
|
import { tmpdir } from "node:os";
|
|
9
9
|
import { join } from "node:path";
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
CLI_CLIENT_INFO,
|
|
13
|
+
buildVaultConfig,
|
|
14
|
+
resolveDefaultHqRoot,
|
|
15
|
+
} from "./cognito-session.js";
|
|
16
|
+
import { CLI_NAME, CLI_VERSION } from "../cli-version.js";
|
|
12
17
|
|
|
13
18
|
describe("resolveDefaultHqRoot", () => {
|
|
14
19
|
let tmpRoot: string;
|
|
@@ -110,3 +115,21 @@ describe("resolveDefaultHqRoot", () => {
|
|
|
110
115
|
expect(resolveDefaultHqRoot()).toBe(explicit);
|
|
111
116
|
});
|
|
112
117
|
});
|
|
118
|
+
|
|
119
|
+
describe("CLI_CLIENT_INFO + buildVaultConfig", () => {
|
|
120
|
+
it("exposes the CLI's package name and version", () => {
|
|
121
|
+
expect(CLI_CLIENT_INFO.name).toBe(CLI_NAME);
|
|
122
|
+
expect(CLI_CLIENT_INFO.version).toBe(CLI_VERSION);
|
|
123
|
+
// Name should always be the @indigoai-us scoped slug — guard against accidental
|
|
124
|
+
// renames that would silently break server-side traffic attribution.
|
|
125
|
+
expect(CLI_NAME).toBe("@indigoai-us/hq-cli");
|
|
126
|
+
expect(CLI_VERSION).toMatch(/^\d+\.\d+\.\d+/);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it("buildVaultConfig stamps clientInfo onto the returned config", () => {
|
|
130
|
+
const cfg = buildVaultConfig("dummy-token");
|
|
131
|
+
expect(cfg.clientInfo).toBe(CLI_CLIENT_INFO);
|
|
132
|
+
expect(cfg.clientInfo?.name).toBe("@indigoai-us/hq-cli");
|
|
133
|
+
expect(cfg.clientInfo?.version).toBe(CLI_VERSION);
|
|
134
|
+
});
|
|
135
|
+
});
|
|
@@ -28,9 +28,12 @@ import {
|
|
|
28
28
|
isExpiring,
|
|
29
29
|
refreshTokens,
|
|
30
30
|
browserLogin,
|
|
31
|
+
detectHqCoreVersion,
|
|
31
32
|
type CognitoAuthConfig,
|
|
33
|
+
type ClientInfo,
|
|
32
34
|
type VaultServiceConfig,
|
|
33
35
|
} from "@indigoai-us/hq-cloud";
|
|
36
|
+
import { CLI_NAME, CLI_VERSION } from "../cli-version.js";
|
|
34
37
|
|
|
35
38
|
export const DEFAULT_COGNITO: CognitoAuthConfig = {
|
|
36
39
|
region: process.env.AWS_REGION ?? "us-east-1",
|
|
@@ -146,12 +149,27 @@ export async function ensureCognitoToken(options: {
|
|
|
146
149
|
return tokens.accessToken;
|
|
147
150
|
}
|
|
148
151
|
|
|
152
|
+
/**
|
|
153
|
+
* The CLI's own ClientInfo. Resolved once at module load so every VaultClient
|
|
154
|
+
* built in this process stamps the same name/version onto its requests.
|
|
155
|
+
*
|
|
156
|
+
* `hqCoreVersion` is filled in lazily by walking up from cwd to find
|
|
157
|
+
* `core/core.yaml` — present only when the CLI is invoked from inside an
|
|
158
|
+
* hq-core checkout, so the server can see scaffold-generation skew.
|
|
159
|
+
*/
|
|
160
|
+
export const CLI_CLIENT_INFO: ClientInfo = {
|
|
161
|
+
name: CLI_NAME,
|
|
162
|
+
version: CLI_VERSION,
|
|
163
|
+
hqCoreVersion: detectHqCoreVersion(),
|
|
164
|
+
};
|
|
165
|
+
|
|
149
166
|
/** Build a VaultServiceConfig with the given access token. */
|
|
150
167
|
export function buildVaultConfig(authToken: string): VaultServiceConfig {
|
|
151
168
|
return {
|
|
152
169
|
apiUrl: DEFAULT_VAULT_API_URL,
|
|
153
170
|
authToken,
|
|
154
171
|
region: DEFAULT_COGNITO.region,
|
|
172
|
+
clientInfo: CLI_CLIENT_INFO,
|
|
155
173
|
};
|
|
156
174
|
}
|
|
157
175
|
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* signals.test.ts — E2E tests for `hq signals` (US-007).
|
|
3
|
+
*
|
|
4
|
+
* Drives the full CLI through `runCli` with `globalThis.fetch` stubbed
|
|
5
|
+
* (vault-service) and the hq-cloud signals S3 factory swapped to an
|
|
6
|
+
* in-memory stub. Covers the three e2e cases defined in the PRD:
|
|
7
|
+
*
|
|
8
|
+
* 1. `hq signals list --entity indigo --type action_item --format json`
|
|
9
|
+
* → exit 0, JSON entry with signalId='xyz'.
|
|
10
|
+
* 2. `hq signals list --entity indigo --type ramble`
|
|
11
|
+
* → exit 1, stderr lists the six canonical signal types.
|
|
12
|
+
* 3. `hq signals types`
|
|
13
|
+
* → exit 0, stdout equals "action_item\ncommitment\ndecision\nkey_point\nrisk\nsummary\n".
|
|
14
|
+
*
|
|
15
|
+
* HQ_ACCESS_TOKEN is set per-test so resolveAccessToken() short-circuits
|
|
16
|
+
* away from the interactive Cognito flow.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { mkdtempSync, rmSync } from "node:fs";
|
|
20
|
+
import { tmpdir } from "node:os";
|
|
21
|
+
import { join } from "node:path";
|
|
22
|
+
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
23
|
+
import {
|
|
24
|
+
_setSignalsS3Factory,
|
|
25
|
+
_resetSignalsS3Factory,
|
|
26
|
+
} from "@indigoai-us/hq-cloud";
|
|
27
|
+
import { mockS3WithEntries } from "../helpers/s3-list-mock.js";
|
|
28
|
+
import { mockVaultService } from "../helpers/vault-service-mock.js";
|
|
29
|
+
import { runCli } from "../helpers/cli-runner.js";
|
|
30
|
+
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
// Fixture — action_item signal matching sources-pipeline output shape
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
|
|
35
|
+
const ACTION_ITEM_MD = `---
|
|
36
|
+
signal_id: xyz
|
|
37
|
+
signal_type: action_item
|
|
38
|
+
source_ref: abc-meeting-001
|
|
39
|
+
citations:
|
|
40
|
+
- "Stefan to review the sources pipeline implementation by end of week"
|
|
41
|
+
entity_refs:
|
|
42
|
+
- stefan@indigoai.us
|
|
43
|
+
created_at: "2026-03-15T15:00:00Z"
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
Stefan will review the sources pipeline implementation and provide feedback by Friday.
|
|
47
|
+
`;
|
|
48
|
+
|
|
49
|
+
const BODY_SENTINEL = "Stefan will review the sources pipeline implementation";
|
|
50
|
+
|
|
51
|
+
// ---------------------------------------------------------------------------
|
|
52
|
+
// Per-test setup — vault + S3 mocks + isolated --hq-root
|
|
53
|
+
// ---------------------------------------------------------------------------
|
|
54
|
+
|
|
55
|
+
let restoreFetch: (() => void) | undefined;
|
|
56
|
+
let tmpHqRoot: string;
|
|
57
|
+
let savedEnv: { HQ_ACCESS_TOKEN: string | undefined };
|
|
58
|
+
|
|
59
|
+
beforeEach(() => {
|
|
60
|
+
savedEnv = { HQ_ACCESS_TOKEN: process.env.HQ_ACCESS_TOKEN };
|
|
61
|
+
process.env.HQ_ACCESS_TOKEN = "test-access-token";
|
|
62
|
+
|
|
63
|
+
tmpHqRoot = mkdtempSync(join(tmpdir(), "hq-signals-test-"));
|
|
64
|
+
|
|
65
|
+
const s3 = mockS3WithEntries({
|
|
66
|
+
entries: [
|
|
67
|
+
{
|
|
68
|
+
key: "signals/action_item/xyz.md",
|
|
69
|
+
content: ACTION_ITEM_MD,
|
|
70
|
+
lastModified: new Date("2026-03-15T15:00:00Z"),
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
});
|
|
74
|
+
_setSignalsS3Factory(() => s3);
|
|
75
|
+
|
|
76
|
+
restoreFetch = mockVaultService({
|
|
77
|
+
entities: [{ uid: "cmp_indigo_001", slug: "indigo", bucketName: "hq-indigo-bucket" }],
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
afterEach(() => {
|
|
82
|
+
_resetSignalsS3Factory();
|
|
83
|
+
restoreFetch?.();
|
|
84
|
+
restoreFetch = undefined;
|
|
85
|
+
rmSync(tmpHqRoot, { recursive: true, force: true });
|
|
86
|
+
|
|
87
|
+
if (savedEnv.HQ_ACCESS_TOKEN === undefined) {
|
|
88
|
+
delete process.env.HQ_ACCESS_TOKEN;
|
|
89
|
+
} else {
|
|
90
|
+
process.env.HQ_ACCESS_TOKEN = savedEnv.HQ_ACCESS_TOKEN;
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
// ---------------------------------------------------------------------------
|
|
95
|
+
// Tests — PRD e2e cases
|
|
96
|
+
// ---------------------------------------------------------------------------
|
|
97
|
+
|
|
98
|
+
describe("hq signals (e2e)", () => {
|
|
99
|
+
it("list --entity indigo --type action_item --format json — exit 0 + signalId='xyz'", async () => {
|
|
100
|
+
const result = await runCli([
|
|
101
|
+
"hq",
|
|
102
|
+
"signals",
|
|
103
|
+
"list",
|
|
104
|
+
"--entity",
|
|
105
|
+
"indigo",
|
|
106
|
+
"--type",
|
|
107
|
+
"action_item",
|
|
108
|
+
"--format",
|
|
109
|
+
"json",
|
|
110
|
+
"--hq-root",
|
|
111
|
+
tmpHqRoot,
|
|
112
|
+
]);
|
|
113
|
+
|
|
114
|
+
expect(result.exitCode, `stderr=${result.stderr}`).toBe(0);
|
|
115
|
+
expect(result.stderr).toBe("");
|
|
116
|
+
|
|
117
|
+
const parsed = JSON.parse(result.stdout) as {
|
|
118
|
+
entries: Array<{ signalId: string; signalType: string; key: string }>;
|
|
119
|
+
nextToken?: string;
|
|
120
|
+
};
|
|
121
|
+
expect(parsed.entries).toHaveLength(1);
|
|
122
|
+
expect(parsed.entries[0].signalId).toBe("xyz");
|
|
123
|
+
expect(parsed.entries[0].signalType).toBe("action_item");
|
|
124
|
+
expect(parsed.entries[0].key).toBe("signals/action_item/xyz.md");
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it("list --entity indigo --type ramble — exit 1 + stderr lists six canonical types", async () => {
|
|
128
|
+
const result = await runCli([
|
|
129
|
+
"hq",
|
|
130
|
+
"signals",
|
|
131
|
+
"list",
|
|
132
|
+
"--entity",
|
|
133
|
+
"indigo",
|
|
134
|
+
"--type",
|
|
135
|
+
"ramble",
|
|
136
|
+
"--format",
|
|
137
|
+
"json",
|
|
138
|
+
"--hq-root",
|
|
139
|
+
tmpHqRoot,
|
|
140
|
+
]);
|
|
141
|
+
|
|
142
|
+
expect(result.exitCode).toBe(1);
|
|
143
|
+
// Every canonical signal type must appear in the error message.
|
|
144
|
+
for (const t of [
|
|
145
|
+
"action_item",
|
|
146
|
+
"commitment",
|
|
147
|
+
"decision",
|
|
148
|
+
"key_point",
|
|
149
|
+
"risk",
|
|
150
|
+
"summary",
|
|
151
|
+
]) {
|
|
152
|
+
expect(result.stderr).toContain(t);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
it("types — exit 0 + stdout equals the sorted six types, one per line", async () => {
|
|
157
|
+
const result = await runCli(["hq", "signals", "types"]);
|
|
158
|
+
expect(result.exitCode).toBe(0);
|
|
159
|
+
// Sorted alphabetically — happens to match SIGNAL_TYPES insertion order.
|
|
160
|
+
expect(result.stdout).toBe(
|
|
161
|
+
"action_item\ncommitment\ndecision\nkey_point\nrisk\nsummary\n",
|
|
162
|
+
);
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
// ---------------------------------------------------------------------------
|
|
167
|
+
// Bonus coverage — get + wiring
|
|
168
|
+
// ---------------------------------------------------------------------------
|
|
169
|
+
|
|
170
|
+
describe("hq signals get", () => {
|
|
171
|
+
it("get --entity indigo --type action_item --id xyz --format markdown — body present", async () => {
|
|
172
|
+
const result = await runCli([
|
|
173
|
+
"hq",
|
|
174
|
+
"signals",
|
|
175
|
+
"get",
|
|
176
|
+
"--entity",
|
|
177
|
+
"indigo",
|
|
178
|
+
"--type",
|
|
179
|
+
"action_item",
|
|
180
|
+
"--id",
|
|
181
|
+
"xyz",
|
|
182
|
+
"--format",
|
|
183
|
+
"markdown",
|
|
184
|
+
"--hq-root",
|
|
185
|
+
tmpHqRoot,
|
|
186
|
+
]);
|
|
187
|
+
|
|
188
|
+
expect(result.exitCode, `stderr=${result.stderr}`).toBe(0);
|
|
189
|
+
expect(result.stderr).toBe("");
|
|
190
|
+
expect(result.stdout).toContain(BODY_SENTINEL);
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
describe("hq --help wiring", () => {
|
|
195
|
+
it("mentions the signals subcommand", async () => {
|
|
196
|
+
const result = await runCli(["hq", "--help"]);
|
|
197
|
+
expect(result.exitCode).toBe(0);
|
|
198
|
+
expect(result.stdout).toContain("signals");
|
|
199
|
+
});
|
|
200
|
+
});
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* sources.test.ts — E2E tests for `hq sources` (US-006).
|
|
3
|
+
*
|
|
4
|
+
* Drives the full CLI through `runCli` with `globalThis.fetch` stubbed
|
|
5
|
+
* (vault-service) and the hq-cloud sources S3 factory swapped to an
|
|
6
|
+
* in-memory stub. Tests the four e2e cases defined in the PRD:
|
|
7
|
+
*
|
|
8
|
+
* 1. `hq sources list --entity indigo --type meeting --format json`
|
|
9
|
+
* → exit 0, JSON entry with sourceId='abc'.
|
|
10
|
+
* 2. `hq sources get --entity indigo --type meeting --id abc`
|
|
11
|
+
* → exit 0, body text present in stdout.
|
|
12
|
+
* 3. `hq sources list --type meeting` (no --entity, no config)
|
|
13
|
+
* → exit 1, stderr mentions --entity.
|
|
14
|
+
* 4. `hq sources list --entity indigo --type pigeon`
|
|
15
|
+
* → exit 1, stderr lists valid channels.
|
|
16
|
+
*
|
|
17
|
+
* HQ_ACCESS_TOKEN is set per-test so resolveAccessToken() short-circuits
|
|
18
|
+
* away from the interactive Cognito flow.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { mkdtempSync, rmSync } from "node:fs";
|
|
22
|
+
import { tmpdir } from "node:os";
|
|
23
|
+
import { join } from "node:path";
|
|
24
|
+
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
25
|
+
import {
|
|
26
|
+
_setSourcesS3Factory,
|
|
27
|
+
_resetSourcesS3Factory,
|
|
28
|
+
} from "@indigoai-us/hq-cloud";
|
|
29
|
+
import { mockS3WithEntries } from "../helpers/s3-list-mock.js";
|
|
30
|
+
import { mockVaultService } from "../helpers/vault-service-mock.js";
|
|
31
|
+
import { runCli } from "../helpers/cli-runner.js";
|
|
32
|
+
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
// Fixtures
|
|
35
|
+
// ---------------------------------------------------------------------------
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Markdown source matching sources-pipeline output shape.
|
|
39
|
+
* NOTE: stored at `sources/meeting/abc.md` (singular `meeting/`) because
|
|
40
|
+
* listSources prefixes with `sources/${channel}/` and channel is the
|
|
41
|
+
* singular SOURCE_CHANNELS member.
|
|
42
|
+
*/
|
|
43
|
+
const MEETING_MD = `---
|
|
44
|
+
source_id: abc
|
|
45
|
+
source_type: meeting
|
|
46
|
+
channel: meeting
|
|
47
|
+
title: Q1 Planning Meeting
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
[Stefan 00:00:05]: Body text goes here for the e2e test.
|
|
51
|
+
[Corey 00:00:12]: Acknowledged.
|
|
52
|
+
`;
|
|
53
|
+
|
|
54
|
+
// Sentinel string used to assert body presence in `hq sources get` output.
|
|
55
|
+
const BODY_SENTINEL = "Body text goes here for the e2e test.";
|
|
56
|
+
|
|
57
|
+
// ---------------------------------------------------------------------------
|
|
58
|
+
// Per-test setup — vault + S3 mocks + isolated --hq-root
|
|
59
|
+
// ---------------------------------------------------------------------------
|
|
60
|
+
|
|
61
|
+
let restoreFetch: (() => void) | undefined;
|
|
62
|
+
let tmpHqRoot: string;
|
|
63
|
+
let savedEnv: { HQ_ACCESS_TOKEN: string | undefined };
|
|
64
|
+
|
|
65
|
+
beforeEach(() => {
|
|
66
|
+
// Sidestep Cognito interactive flow.
|
|
67
|
+
savedEnv = { HQ_ACCESS_TOKEN: process.env.HQ_ACCESS_TOKEN };
|
|
68
|
+
process.env.HQ_ACCESS_TOKEN = "test-access-token";
|
|
69
|
+
|
|
70
|
+
// Empty .hq tree so `readActiveCompanySlug` returns undefined unless a
|
|
71
|
+
// test writes config.json into it.
|
|
72
|
+
tmpHqRoot = mkdtempSync(join(tmpdir(), "hq-sources-test-"));
|
|
73
|
+
|
|
74
|
+
// Default S3 stub returns the one meeting source.
|
|
75
|
+
const s3 = mockS3WithEntries({
|
|
76
|
+
entries: [
|
|
77
|
+
{
|
|
78
|
+
key: "sources/meeting/abc.md",
|
|
79
|
+
content: MEETING_MD,
|
|
80
|
+
lastModified: new Date("2026-03-15T14:00:00Z"),
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
});
|
|
84
|
+
_setSourcesS3Factory(() => s3);
|
|
85
|
+
|
|
86
|
+
// Default vault-service mock with one entity 'indigo'.
|
|
87
|
+
restoreFetch = mockVaultService({
|
|
88
|
+
entities: [{ uid: "cmp_indigo_001", slug: "indigo", bucketName: "hq-indigo-bucket" }],
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
afterEach(() => {
|
|
93
|
+
_resetSourcesS3Factory();
|
|
94
|
+
restoreFetch?.();
|
|
95
|
+
restoreFetch = undefined;
|
|
96
|
+
rmSync(tmpHqRoot, { recursive: true, force: true });
|
|
97
|
+
|
|
98
|
+
if (savedEnv.HQ_ACCESS_TOKEN === undefined) {
|
|
99
|
+
delete process.env.HQ_ACCESS_TOKEN;
|
|
100
|
+
} else {
|
|
101
|
+
process.env.HQ_ACCESS_TOKEN = savedEnv.HQ_ACCESS_TOKEN;
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// ---------------------------------------------------------------------------
|
|
106
|
+
// Tests — PRD e2e cases
|
|
107
|
+
// ---------------------------------------------------------------------------
|
|
108
|
+
|
|
109
|
+
describe("hq sources (e2e)", () => {
|
|
110
|
+
it("list --entity indigo --type meeting --format json — exit 0 + JSON with sourceId='abc'", async () => {
|
|
111
|
+
const result = await runCli([
|
|
112
|
+
"hq",
|
|
113
|
+
"sources",
|
|
114
|
+
"list",
|
|
115
|
+
"--entity",
|
|
116
|
+
"indigo",
|
|
117
|
+
"--type",
|
|
118
|
+
"meeting",
|
|
119
|
+
"--format",
|
|
120
|
+
"json",
|
|
121
|
+
"--hq-root",
|
|
122
|
+
tmpHqRoot,
|
|
123
|
+
]);
|
|
124
|
+
|
|
125
|
+
expect(result.exitCode, `stderr=${result.stderr}`).toBe(0);
|
|
126
|
+
expect(result.stderr).toBe("");
|
|
127
|
+
|
|
128
|
+
const parsed = JSON.parse(result.stdout) as {
|
|
129
|
+
entries: Array<{ sourceId: string; channel: string; key: string }>;
|
|
130
|
+
nextToken?: string;
|
|
131
|
+
};
|
|
132
|
+
expect(parsed.entries).toHaveLength(1);
|
|
133
|
+
expect(parsed.entries[0].sourceId).toBe("abc");
|
|
134
|
+
expect(parsed.entries[0].channel).toBe("meeting");
|
|
135
|
+
expect(parsed.entries[0].key).toBe("sources/meeting/abc.md");
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it("get --entity indigo --type meeting --id abc — exit 0 + stdout contains body text", async () => {
|
|
139
|
+
const result = await runCli([
|
|
140
|
+
"hq",
|
|
141
|
+
"sources",
|
|
142
|
+
"get",
|
|
143
|
+
"--entity",
|
|
144
|
+
"indigo",
|
|
145
|
+
"--type",
|
|
146
|
+
"meeting",
|
|
147
|
+
"--id",
|
|
148
|
+
"abc",
|
|
149
|
+
"--format",
|
|
150
|
+
"markdown",
|
|
151
|
+
"--hq-root",
|
|
152
|
+
tmpHqRoot,
|
|
153
|
+
]);
|
|
154
|
+
|
|
155
|
+
expect(result.exitCode).toBe(0);
|
|
156
|
+
expect(result.stderr).toBe("");
|
|
157
|
+
expect(result.stdout).toContain(BODY_SENTINEL);
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
it("list --type meeting (no --entity, no config) — exit 1 + stderr mentions --entity", async () => {
|
|
161
|
+
// tmpHqRoot has no .hq/config.json, so readActiveCompanySlug returns undefined.
|
|
162
|
+
const result = await runCli([
|
|
163
|
+
"hq",
|
|
164
|
+
"sources",
|
|
165
|
+
"list",
|
|
166
|
+
"--type",
|
|
167
|
+
"meeting",
|
|
168
|
+
"--format",
|
|
169
|
+
"json",
|
|
170
|
+
"--hq-root",
|
|
171
|
+
tmpHqRoot,
|
|
172
|
+
]);
|
|
173
|
+
|
|
174
|
+
expect(result.exitCode).toBe(1);
|
|
175
|
+
expect(result.stderr).toMatch(/--entity/);
|
|
176
|
+
// Also surfaces the discovery affordance.
|
|
177
|
+
expect(result.stderr).toMatch(/hq sources entities/);
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
it("list --entity indigo --type pigeon — exit 1 + stderr lists valid channels", async () => {
|
|
181
|
+
const result = await runCli([
|
|
182
|
+
"hq",
|
|
183
|
+
"sources",
|
|
184
|
+
"list",
|
|
185
|
+
"--entity",
|
|
186
|
+
"indigo",
|
|
187
|
+
"--type",
|
|
188
|
+
"pigeon",
|
|
189
|
+
"--format",
|
|
190
|
+
"json",
|
|
191
|
+
"--hq-root",
|
|
192
|
+
tmpHqRoot,
|
|
193
|
+
]);
|
|
194
|
+
|
|
195
|
+
expect(result.exitCode).toBe(1);
|
|
196
|
+
// Every canonical channel must appear in the error message.
|
|
197
|
+
expect(result.stderr).toContain("meeting");
|
|
198
|
+
expect(result.stderr).toContain("email");
|
|
199
|
+
expect(result.stderr).toContain("slack");
|
|
200
|
+
expect(result.stderr).toContain("linear");
|
|
201
|
+
expect(result.stderr).toContain("notion");
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
// ---------------------------------------------------------------------------
|
|
206
|
+
// Bonus coverage — channels + wiring
|
|
207
|
+
// ---------------------------------------------------------------------------
|
|
208
|
+
|
|
209
|
+
describe("hq sources channels", () => {
|
|
210
|
+
it("prints SOURCE_CHANNELS sorted, one per line, exit 0", async () => {
|
|
211
|
+
const result = await runCli(["hq", "sources", "channels"]);
|
|
212
|
+
expect(result.exitCode).toBe(0);
|
|
213
|
+
const lines = result.stdout.trim().split("\n");
|
|
214
|
+
// Sorted alphabetically: email, linear, meeting, notion, slack
|
|
215
|
+
expect(lines).toEqual(["email", "linear", "meeting", "notion", "slack"]);
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
describe("hq --help wiring", () => {
|
|
220
|
+
it("mentions the sources subcommand", async () => {
|
|
221
|
+
const result = await runCli(["hq", "--help"]);
|
|
222
|
+
expect(result.exitCode).toBe(0);
|
|
223
|
+
expect(result.stdout).toContain("sources");
|
|
224
|
+
});
|
|
225
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
signal_id: sig_action_001
|
|
3
|
+
signal_type: action_item
|
|
4
|
+
source_ref: abc-meeting-001
|
|
5
|
+
citations:
|
|
6
|
+
- "Stefan to review the sources pipeline implementation by end of week"
|
|
7
|
+
- "Corey to prepare roadmap slides for the next planning session"
|
|
8
|
+
entity_refs:
|
|
9
|
+
- stefan@indigoai.us
|
|
10
|
+
- corey@indigoai.us
|
|
11
|
+
created_at: "2026-03-15T15:00:00Z"
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
Stefan will review the sources pipeline implementation and provide feedback by Friday 2026-03-20.
|
|
15
|
+
|
|
16
|
+
Corey will prepare updated roadmap slides covering the CLI read surface and signal type validation for the follow-up planning session.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
signal_id: sig_summary_001
|
|
3
|
+
signal_type: summary
|
|
4
|
+
source_ref: abc-meeting-001
|
|
5
|
+
citations: []
|
|
6
|
+
entity_refs:
|
|
7
|
+
- stefan@indigoai.us
|
|
8
|
+
- corey@indigoai.us
|
|
9
|
+
created_at: "2026-03-15T15:00:00Z"
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
The Q1 planning meeting covered roadmap priorities for the sources pipeline and CLI tooling. Key decisions included implementing the `hq sources` and `hq signals` commands in hq-cli, enforcing a closed signal-type enum to prevent agents from inventing new types, and using STS-scoped credentials via vault-service for tenant isolation. The team agreed to ship a read-only CLI surface first before tackling S3 Vectors search in Phase 2.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
source_id: abc-meeting-001
|
|
3
|
+
source_type: meeting
|
|
4
|
+
channel: meeting
|
|
5
|
+
title: Q1 Planning Meeting
|
|
6
|
+
date: "2026-03-15"
|
|
7
|
+
participants:
|
|
8
|
+
- name: Stefan Johnson
|
|
9
|
+
email: stefan@indigoai.us
|
|
10
|
+
- name: Corey Smith
|
|
11
|
+
email: corey@indigoai.us
|
|
12
|
+
duration_seconds: 3600
|
|
13
|
+
entity_ref: cmp_indigo_001
|
|
14
|
+
created_at: "2026-03-15T14:00:00Z"
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
[Stefan Johnson 00:00:05]: Good morning everyone. Let's get started with the Q1 planning session.
|
|
18
|
+
|
|
19
|
+
[Corey Smith 00:00:12]: Morning! I have the roadmap slides ready to share.
|
|
20
|
+
|
|
21
|
+
[Stefan Johnson 00:00:18]: Perfect. First item on the agenda is the sources pipeline work. We need to add a read surface to the CLI so agents and users can browse sources and signals without writing AWS code.
|
|
22
|
+
|
|
23
|
+
[Corey Smith 00:00:35]: Makes sense. The S3 layout is already defined by the pipeline — sources/{channel}/{sourceId}.md. We just need the listing and fetch commands.
|
|
24
|
+
|
|
25
|
+
[Stefan Johnson 00:00:48]: Exactly. And we should enforce signal type validation at the CLI layer too. No invented signal types from agents.
|