@indigoai-us/hq-cli 5.345.230 → 5.345.232
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 +54 -0
- package/README.md +3 -2
- package/assets/lanes-reconcile/hq-lanes-reconcile.service +1 -1
- package/assets/scaffold/core/scripts/pipeline-conductor.sh +14 -14
- package/assets/scaffold/core/scripts/pipeline-driver.sh +7 -7
- package/assets/scaffold/core/scripts/session-project.sh +19 -4
- package/dist/command-catalog.generated.d.ts +213 -177
- package/dist/command-catalog.generated.js +263 -212
- package/dist/command-registration-plan.d.ts +6 -24
- package/dist/command-registration-plan.js +4 -8
- package/dist/commands/auth.js +3 -2
- package/dist/commands/core-pipeline-conductor-command.js +1 -1
- package/dist/commands/core-pipeline-conductor-native.js +5 -5
- package/dist/commands/core-pipeline-driver-native.js +5 -5
- package/dist/commands/crm.js +2 -1
- package/dist/commands/daemon.js +7 -36
- package/dist/commands/deploy-access.js +6 -13
- package/dist/commands/deploy-comments.js +5 -13
- package/dist/commands/deploy-domains.js +6 -13
- package/dist/commands/deploy-list.js +25 -11
- package/dist/commands/deploy-mutations.d.ts +3 -0
- package/dist/commands/deploy-mutations.js +147 -0
- package/dist/commands/link.js +29 -0
- package/dist/commands/mesh.js +3 -1
- package/dist/commands/packs.js +3 -2
- package/dist/commands/pkg-remove.js +2 -1
- package/dist/commands/report.js +12 -9
- package/dist/data/command-states.json +10 -7
- package/dist/lib/bot/fleet-bots-update-pass.d.ts +8 -0
- package/dist/lib/bot/fleet-bots-update-pass.js +40 -0
- package/dist/lib/bot/fleet-bots-update-task.d.ts +12 -0
- package/dist/lib/bot/fleet-bots-update-task.js +52 -0
- package/dist/lib/bot/fleet-bots-update-worker-v1.d.ts +2 -0
- package/dist/lib/bot/fleet-bots-update-worker-v1.js +5 -0
- package/dist/lib/daemon/catalog.d.ts +8 -5
- package/dist/lib/daemon/catalog.js +15 -8
- package/dist/lib/daemon/hook-requests-codex-settings.d.ts +26 -0
- package/dist/lib/daemon/hook-requests-codex-settings.js +185 -0
- package/dist/lib/daemon/hook-requests-conduct-link.d.ts +1 -0
- package/dist/lib/daemon/hook-requests-conduct-link.js +21 -4
- package/dist/lib/daemon/hook-requests.d.ts +3 -2
- package/dist/lib/daemon/hook-requests.js +16 -3
- package/dist/lib/daemon/lock.js +33 -37
- package/dist/lib/daemon/ops/skill-command.d.ts +99 -0
- package/dist/lib/daemon/ops/skill-command.js +260 -0
- package/dist/lib/daemon/protocol.d.ts +1 -1
- package/dist/lib/daemon/protocol.js +1 -0
- package/dist/lib/daemon/run.js +10 -18
- package/dist/lib/daemon/server.js +7 -0
- package/dist/lib/daemon/supervisor.d.ts +5 -0
- package/dist/lib/daemon/supervisor.js +17 -2
- package/dist/lib/db/app-ref.js +10 -15
- package/dist/lib/deploy-apps.d.ts +29 -0
- package/dist/lib/deploy-apps.js +37 -0
- package/dist/lib/doctor/checks/search-index.d.ts +16 -0
- package/dist/lib/doctor/checks/search-index.js +61 -0
- package/dist/lib/doctor/checks/stranded-lanes.js +1 -1
- package/dist/lib/doctor/registry.js +4 -0
- package/dist/lib/flag-registry.d.ts +7 -0
- package/dist/lib/flag-registry.js +20 -0
- package/dist/lib/hook-engine/coverage.d.ts +18 -0
- package/dist/lib/hook-engine/coverage.js +42 -1
- package/dist/lib/lanes/accounts.js +3 -3
- package/dist/lib/lanes/admission-host.js +1 -1
- package/dist/lib/lanes/admission.js +4 -4
- package/dist/lib/lanes/autopilot.js +2 -2
- package/dist/lib/lanes/blocker-freshness.js +1 -1
- package/dist/lib/lanes/compaction.js +5 -5
- package/dist/lib/lanes/delivery.js +1 -1
- package/dist/lib/lanes/depth-cap.js +1 -1
- package/dist/lib/lanes/disk-guard.js +1 -1
- package/dist/lib/lanes/dropbox.js +1 -1
- package/dist/lib/lanes/hooks-install.js +1 -1
- package/dist/lib/lanes/imported-question.js +1 -1
- package/dist/lib/lanes/keep-alive.d.ts +2 -2
- package/dist/lib/lanes/keep-alive.js +3 -3
- package/dist/lib/lanes/kr-freshness.js +1 -1
- package/dist/lib/lanes/links.js +92 -11
- package/dist/lib/lanes/loop.js +2 -2
- package/dist/lib/lanes/machine-identity.js +3 -3
- package/dist/lib/lanes/models.js +6 -6
- package/dist/lib/lanes/quota.js +1 -1
- package/dist/lib/lanes/reconcile-install.js +3 -3
- package/dist/lib/lanes/reconcile.js +16 -16
- package/dist/lib/lanes/remote-control-lane.js +6 -6
- package/dist/lib/lanes/reviews.js +2 -2
- package/dist/lib/lanes/spawn.js +24 -24
- package/dist/lib/lanes/status-fields.js +4 -4
- package/dist/lib/lanes/wait.js +4 -4
- package/dist/lib/lanes/watch.js +2 -2
- package/dist/lib/lanes/watcher-main.js +1 -1
- package/dist/lib/lanes/watcher.js +38 -38
- package/dist/lib/lanes/worker-process.js +5 -5
- package/dist/lib/mesh/live/daemon/pid-lock.d.ts +2 -4
- package/dist/lib/mesh/live/daemon/pid-lock.js +38 -55
- package/dist/utils/exclusive-lock.d.ts +60 -0
- package/dist/utils/exclusive-lock.js +65 -0
- package/dist/utils/exit-after-worker.d.ts +7 -0
- package/dist/utils/exit-after-worker.js +15 -0
- package/package.json +8 -7
- package/dist/commands/staff/listings.d.ts +0 -41
- package/dist/commands/staff/listings.js +0 -160
- package/dist/commands/staff/reset-test-account.d.ts +0 -121
- package/dist/commands/staff/reset-test-account.js +0 -285
- package/dist/commands/staff/test-account.d.ts +0 -51
- package/dist/commands/staff/test-account.js +0 -196
|
@@ -72,4 +72,69 @@ export function acquireLockFileExclusively(candidate, lockFile, dirKey) {
|
|
|
72
72
|
mode: 0o600,
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
|
+
/** Parse a `pid=<n>\nts=<n>` body; null unless both fields are plain digits. */
|
|
76
|
+
export function parsePidLockRecord(content) {
|
|
77
|
+
const fields = {};
|
|
78
|
+
for (const line of content.split("\n")) {
|
|
79
|
+
const i = line.indexOf("=");
|
|
80
|
+
if (i === -1)
|
|
81
|
+
continue;
|
|
82
|
+
fields[line.slice(0, i)] = line.slice(i + 1);
|
|
83
|
+
}
|
|
84
|
+
if (!/^\d+$/.test(fields.pid ?? "") || !/^\d+$/.test(fields.ts ?? "")) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
return { pid: Number(fields.pid), ts: Number(fields.ts) };
|
|
88
|
+
}
|
|
89
|
+
/** Read and parse a lock file. A missing file, a read error or a parse error is null. */
|
|
90
|
+
export function readLockFile(lockPath, parse, deps = {}) {
|
|
91
|
+
const existsSync = deps.existsSync ?? fs.existsSync;
|
|
92
|
+
const readFileSync = deps.readFileSync ?? fs.readFileSync;
|
|
93
|
+
if (!existsSync(lockPath))
|
|
94
|
+
return null;
|
|
95
|
+
try {
|
|
96
|
+
return parse(readFileSync(lockPath, "utf8"));
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Create `lockPath` with `body` exclusively (`wx`, mode 0600). True when this
|
|
104
|
+
* call created it, false when it already exists (EEXIST); any other error is
|
|
105
|
+
* thrown.
|
|
106
|
+
*/
|
|
107
|
+
export function createLockFile(lockPath, body, writeFileSync = fs.writeFileSync) {
|
|
108
|
+
try {
|
|
109
|
+
writeFileSync(lockPath, body, { flag: "wx", mode: 0o600 });
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
if (error?.code === "EEXIST")
|
|
114
|
+
return false;
|
|
115
|
+
throw error;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
export function lockIsStale(policy, observed) {
|
|
119
|
+
switch (policy.kind) {
|
|
120
|
+
case "none":
|
|
121
|
+
return false;
|
|
122
|
+
case "pid": {
|
|
123
|
+
const owner = "owner" in observed ? observed.owner : null;
|
|
124
|
+
return !(owner && owner.pid !== policy.self && policy.alive(owner.pid));
|
|
125
|
+
}
|
|
126
|
+
case "age": {
|
|
127
|
+
const ageMs = "ageMs" in observed ? observed.ageMs : Number.NaN;
|
|
128
|
+
return !(ageMs <= policy.maxAgeMs);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/** Remove the lock only when this holder owns it. True when `remove` ran. */
|
|
133
|
+
export function releaseLockFile(lockPath, release) {
|
|
134
|
+
const owner = release.read(lockPath);
|
|
135
|
+
if (owner === null || !release.owns(owner))
|
|
136
|
+
return false;
|
|
137
|
+
release.remove(lockPath);
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
75
140
|
//# sourceMappingURL=exclusive-lock.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* End the CLI with `code` after the flag-registry worker has stopped.
|
|
3
|
+
* Use `return await exitCli(code)` (or `await exitCli(code)` as the last
|
|
4
|
+
* statement) so no code runs past the call while the worker stops.
|
|
5
|
+
*/
|
|
6
|
+
export declare function exitCli(code: number): Promise<never>;
|
|
7
|
+
//# sourceMappingURL=exit-after-worker.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { stopFlagRegistryWorker } from "../lib/flag-registry.js";
|
|
2
|
+
/**
|
|
3
|
+
* End the CLI with `code` after the flag-registry worker has stopped.
|
|
4
|
+
* Use `return await exitCli(code)` (or `await exitCli(code)` as the last
|
|
5
|
+
* statement) so no code runs past the call while the worker stops.
|
|
6
|
+
*/
|
|
7
|
+
export async function exitCli(code) {
|
|
8
|
+
try {
|
|
9
|
+
await stopFlagRegistryWorker();
|
|
10
|
+
}
|
|
11
|
+
finally {
|
|
12
|
+
process.exit(code);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=exit-after-worker.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@indigoai-us/hq-cli",
|
|
3
|
-
"version": "5.345.
|
|
3
|
+
"version": "5.345.232",
|
|
4
4
|
"description": "HQ by Indigo management CLI — modules and cloud sync",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"!dist/**/__testing__",
|
|
15
15
|
"!dist/**/*.test-d.*",
|
|
16
16
|
"!dist/lib/test-utils",
|
|
17
|
+
"!dist/staff",
|
|
17
18
|
"!dist/lib/decisions/fixtures",
|
|
18
19
|
"!dist/lib/fingerprint/fixtures.*",
|
|
19
20
|
"assets/scaffold",
|
|
@@ -125,11 +126,11 @@
|
|
|
125
126
|
"*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}": "eslint --cache --no-error-on-unmatched-pattern"
|
|
126
127
|
},
|
|
127
128
|
"optionalDependencies": {
|
|
128
|
-
"@indigoai-us/hq-hook-win32-x64": "5.345.
|
|
129
|
-
"@indigoai-us/hq-hook-win32-arm64": "5.345.
|
|
130
|
-
"@indigoai-us/hq-hook-darwin-x64": "5.345.
|
|
131
|
-
"@indigoai-us/hq-hook-darwin-arm64": "5.345.
|
|
132
|
-
"@indigoai-us/hq-hook-linux-x64": "5.345.
|
|
133
|
-
"@indigoai-us/hq-hook-linux-arm64": "5.345.
|
|
129
|
+
"@indigoai-us/hq-hook-win32-x64": "5.345.232",
|
|
130
|
+
"@indigoai-us/hq-hook-win32-arm64": "5.345.232",
|
|
131
|
+
"@indigoai-us/hq-hook-darwin-x64": "5.345.232",
|
|
132
|
+
"@indigoai-us/hq-hook-darwin-arm64": "5.345.232",
|
|
133
|
+
"@indigoai-us/hq-hook-linux-x64": "5.345.232",
|
|
134
|
+
"@indigoai-us/hq-hook-linux-arm64": "5.345.232"
|
|
134
135
|
}
|
|
135
136
|
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
/**
|
|
3
|
-
* `hq staff listings {queue|approve|reject}` — marketplace moderation from the
|
|
4
|
-
* CLI. Thin wrappers over the vault-service moderation routes:
|
|
5
|
-
*
|
|
6
|
-
* GET /v1/moderation/queue (queue)
|
|
7
|
-
* POST /v1/moderation/listings/{id} (approve | reject, body { action, note? })
|
|
8
|
-
*
|
|
9
|
-
* Every `hq publish` lands as `pending_review` and stays off the public
|
|
10
|
-
* marketplace until a staff member decides it. Before this command the only
|
|
11
|
-
* way to decide was the GTM admin web page. The server owns authorization
|
|
12
|
-
* (`isStaffEmail` on the id_token's email claim) and the state machine
|
|
13
|
-
* (pending_review -> approved | rejected, optimistic lock, superseding older
|
|
14
|
-
* approved versions). The moderation gate reads the `email` claim, which only
|
|
15
|
-
* the id_token carries, so this file uses `ensureCognitoIdToken`.
|
|
16
|
-
*/
|
|
17
|
-
export interface QueueItem {
|
|
18
|
-
listingId: string;
|
|
19
|
-
type?: string;
|
|
20
|
-
status?: string;
|
|
21
|
-
creatorHandle?: string;
|
|
22
|
-
name?: string;
|
|
23
|
-
slug?: string;
|
|
24
|
-
version?: string;
|
|
25
|
-
summary?: string;
|
|
26
|
-
createdAt?: string;
|
|
27
|
-
injectionScan?: {
|
|
28
|
-
flagged?: boolean;
|
|
29
|
-
flags?: unknown[];
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
export declare function renderQueue(items: QueueItem[]): string;
|
|
33
|
-
export declare function runListingsQueue(): Promise<void>;
|
|
34
|
-
export interface RunDecisionParams {
|
|
35
|
-
listingId: string;
|
|
36
|
-
note?: string;
|
|
37
|
-
}
|
|
38
|
-
export declare function runApproveListing(params: RunDecisionParams): Promise<void>;
|
|
39
|
-
export declare function runRejectListing(params: RunDecisionParams): Promise<void>;
|
|
40
|
-
export declare function registerListingsCommand(staff: Command): Command;
|
|
41
|
-
//# sourceMappingURL=listings.d.ts.map
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import chalk from "chalk";
|
|
2
|
-
import { ensureCognitoIdToken } from "../../utils/cognito-session.js";
|
|
3
|
-
import { vaultApiFetch } from "../../utils/vault-api.js";
|
|
4
|
-
import { callerEmailFromToken, isStaffEmail } from "./reset-test-account.js";
|
|
5
|
-
// ── Rendering ───────────────────────────────────────────────────────────────
|
|
6
|
-
function renderQueueLine(item) {
|
|
7
|
-
const pack = `${item.slug ?? item.name ?? "?"}@${item.version ?? "?"}`;
|
|
8
|
-
const creator = item.creatorHandle ? `@${item.creatorHandle}` : chalk.dim("(no handle)");
|
|
9
|
-
const flag = item.injectionScan?.flagged
|
|
10
|
-
? chalk.yellow(` flagged (${item.injectionScan.flags?.length ?? 0})`)
|
|
11
|
-
: "";
|
|
12
|
-
const when = item.createdAt ? chalk.dim(` ${item.createdAt}`) : "";
|
|
13
|
-
return ` ${item.listingId} ${pack.padEnd(28)} ${(item.type ?? "").padEnd(6)} ${creator}${when}${flag}`;
|
|
14
|
-
}
|
|
15
|
-
export function renderQueue(items) {
|
|
16
|
-
if (items.length === 0) {
|
|
17
|
-
return chalk.dim("\n(no listings waiting for review)");
|
|
18
|
-
}
|
|
19
|
-
const lines = [chalk.bold(`\nListings waiting for review (${items.length}, oldest first)`)];
|
|
20
|
-
for (const item of items)
|
|
21
|
-
lines.push(renderQueueLine(item));
|
|
22
|
-
lines.push(chalk.dim("\nApprove with `hq staff listings approve <id>`, reject with `hq staff listings reject <id> --note <reason>`."));
|
|
23
|
-
return lines.join("\n");
|
|
24
|
-
}
|
|
25
|
-
// ── Shared helpers ──────────────────────────────────────────────────────────
|
|
26
|
-
async function readBody(res) {
|
|
27
|
-
try {
|
|
28
|
-
return (await res.json());
|
|
29
|
-
}
|
|
30
|
-
catch {
|
|
31
|
-
return {};
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
function renderApiError(status, body) {
|
|
35
|
-
const code = typeof body.code === "string" ? body.code : undefined;
|
|
36
|
-
const message = typeof body.error === "string" ? body.error : `request failed (${status})`;
|
|
37
|
-
return code ? `${code}: ${message}` : message;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Local staff preflight so a non-staff caller stops before the round trip.
|
|
41
|
-
* The server remains the authorization boundary.
|
|
42
|
-
*/
|
|
43
|
-
async function requireStaffIdToken() {
|
|
44
|
-
const token = await ensureCognitoIdToken();
|
|
45
|
-
const callerEmail = callerEmailFromToken(token);
|
|
46
|
-
if (!callerEmail || !isStaffEmail(callerEmail)) {
|
|
47
|
-
throw new Error("hq staff listings requires a staff HQ session (@getindigo.ai, @hqforwork.com or @vyg.ai). " +
|
|
48
|
-
"Sign in with a staff account and retry.");
|
|
49
|
-
}
|
|
50
|
-
return token;
|
|
51
|
-
}
|
|
52
|
-
const LISTING_ID_RE = /^lst_[0-9A-Za-z]+$/;
|
|
53
|
-
function requireListingId(listingId) {
|
|
54
|
-
const id = listingId.trim();
|
|
55
|
-
if (!LISTING_ID_RE.test(id)) {
|
|
56
|
-
throw new Error(`"${listingId}" is not a listing id (expected lst_…). Run \`hq staff listings queue\` to see ids.`);
|
|
57
|
-
}
|
|
58
|
-
return id;
|
|
59
|
-
}
|
|
60
|
-
// ── Runners ─────────────────────────────────────────────────────────────────
|
|
61
|
-
export async function runListingsQueue() {
|
|
62
|
-
const token = await requireStaffIdToken();
|
|
63
|
-
const res = await vaultApiFetch({ token, path: "/v1/moderation/queue", method: "GET" });
|
|
64
|
-
const parsed = await readBody(res);
|
|
65
|
-
if (!res.ok)
|
|
66
|
-
throw new Error(renderApiError(res.status, parsed));
|
|
67
|
-
const queue = parsed.queue;
|
|
68
|
-
if (!Array.isArray(queue))
|
|
69
|
-
throw new Error("server did not return a moderation queue");
|
|
70
|
-
console.log(renderQueue(queue));
|
|
71
|
-
}
|
|
72
|
-
async function decide(action, params) {
|
|
73
|
-
const id = requireListingId(params.listingId);
|
|
74
|
-
const token = await requireStaffIdToken();
|
|
75
|
-
const body = { action };
|
|
76
|
-
if (params.note !== undefined && params.note.trim().length > 0)
|
|
77
|
-
body.note = params.note.trim();
|
|
78
|
-
const res = await vaultApiFetch({
|
|
79
|
-
token,
|
|
80
|
-
path: `/v1/moderation/listings/${encodeURIComponent(id)}`,
|
|
81
|
-
method: "POST",
|
|
82
|
-
body,
|
|
83
|
-
});
|
|
84
|
-
const parsed = await readBody(res);
|
|
85
|
-
if (!res.ok) {
|
|
86
|
-
const msg = renderApiError(res.status, parsed);
|
|
87
|
-
if (res.status === 409) {
|
|
88
|
-
throw new Error(`${msg} (the listing is no longer pending, or someone decided it at the same time)`);
|
|
89
|
-
}
|
|
90
|
-
throw new Error(msg);
|
|
91
|
-
}
|
|
92
|
-
return parsed;
|
|
93
|
-
}
|
|
94
|
-
function labelOf(listing, fallbackId) {
|
|
95
|
-
if (!listing)
|
|
96
|
-
return fallbackId;
|
|
97
|
-
return `${listing.slug ?? listing.name ?? fallbackId}@${listing.version ?? "?"} (${listing.listingId ?? fallbackId})`;
|
|
98
|
-
}
|
|
99
|
-
export async function runApproveListing(params) {
|
|
100
|
-
const result = await decide("approve", params);
|
|
101
|
-
console.log(chalk.green(`\n✓ approved ${labelOf(result.listing, params.listingId)}`));
|
|
102
|
-
const superseded = result.superseded ?? [];
|
|
103
|
-
if (superseded.length > 0) {
|
|
104
|
-
console.log(chalk.dim(` superseded older versions: ${superseded.join(", ")}`));
|
|
105
|
-
}
|
|
106
|
-
console.log(chalk.dim(" It is now live in the marketplace (the public pack page refreshes within ~10 minutes)."));
|
|
107
|
-
}
|
|
108
|
-
export async function runRejectListing(params) {
|
|
109
|
-
const result = await decide("reject", params);
|
|
110
|
-
console.log(chalk.yellow(`\n✗ rejected ${labelOf(result.listing, params.listingId)}`));
|
|
111
|
-
}
|
|
112
|
-
// ── Commander wiring ────────────────────────────────────────────────────────
|
|
113
|
-
function fail(err) {
|
|
114
|
-
console.error(chalk.red(err instanceof Error ? err.message : String(err)));
|
|
115
|
-
process.exit(1);
|
|
116
|
-
}
|
|
117
|
-
export function registerListingsCommand(staff) {
|
|
118
|
-
const group = staff
|
|
119
|
-
.command("listings")
|
|
120
|
-
.description("Review marketplace listings waiting for approval (staff only). Wraps /v1/moderation.");
|
|
121
|
-
group
|
|
122
|
-
.command("queue")
|
|
123
|
-
.description("List published packs waiting for review, oldest first.")
|
|
124
|
-
.action(async () => {
|
|
125
|
-
try {
|
|
126
|
-
await runListingsQueue();
|
|
127
|
-
}
|
|
128
|
-
catch (err) {
|
|
129
|
-
fail(err);
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
group
|
|
133
|
-
.command("approve")
|
|
134
|
-
.description("Approve a pending listing so it goes live (older approved versions are superseded).")
|
|
135
|
-
.argument("<listingId>", "Listing id from `hq staff listings queue` (lst_…)")
|
|
136
|
-
.option("--note <text>", "Reviewer note recorded on the listing")
|
|
137
|
-
.action(async (listingId, opts) => {
|
|
138
|
-
try {
|
|
139
|
-
await runApproveListing({ listingId, note: opts.note });
|
|
140
|
-
}
|
|
141
|
-
catch (err) {
|
|
142
|
-
fail(err);
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
group
|
|
146
|
-
.command("reject")
|
|
147
|
-
.description("Reject a pending listing.")
|
|
148
|
-
.argument("<listingId>", "Listing id from `hq staff listings queue` (lst_…)")
|
|
149
|
-
.requiredOption("--note <reason>", "Why it was rejected (recorded on the listing)")
|
|
150
|
-
.action(async (listingId, opts) => {
|
|
151
|
-
try {
|
|
152
|
-
await runRejectListing({ listingId, note: opts.note });
|
|
153
|
-
}
|
|
154
|
-
catch (err) {
|
|
155
|
-
fail(err);
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
return group;
|
|
159
|
-
}
|
|
160
|
-
//# sourceMappingURL=listings.js.map
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
/**
|
|
3
|
-
* `hq staff reset-test-account <email>` — onboarding-test-accounts US-007.
|
|
4
|
-
*
|
|
5
|
-
* Thin CLI wrapper over `POST /v1/admin/test-account/reset` (US-003 dry-run +
|
|
6
|
-
* US-006 execute). Server owns every safety gate; this file owns two operator
|
|
7
|
-
* ergonomics the wire cannot: (1) a LOCAL staff-email preflight so a non-staff
|
|
8
|
-
* caller stops here instead of paying a round trip for the same 403, and (2)
|
|
9
|
-
* the typed-email confirmation prompt for `--execute`, whose value is what the
|
|
10
|
-
* server matches against `plan.target.normalizedEmail` via `confirmEmailMatches`.
|
|
11
|
-
*
|
|
12
|
-
* OQ-003 recommendation: this ships as a subcommand of the existing hq CLI
|
|
13
|
-
* (`hq staff …`) rather than a separate `hq-staff` binary — reuses auth,
|
|
14
|
-
* distribution, and telemetry with zero new plumbing.
|
|
15
|
-
*/
|
|
16
|
-
interface PlanCognitoUser {
|
|
17
|
-
username: string;
|
|
18
|
-
sub: string;
|
|
19
|
-
provider: string;
|
|
20
|
-
email: string;
|
|
21
|
-
}
|
|
22
|
-
interface PlanCompany {
|
|
23
|
-
uid: string;
|
|
24
|
-
slug: string;
|
|
25
|
-
memberCount: number;
|
|
26
|
-
}
|
|
27
|
-
interface PlanCompanyHandoff {
|
|
28
|
-
companyUid: string;
|
|
29
|
-
companySlug: string;
|
|
30
|
-
toPersonUid: string;
|
|
31
|
-
toEmail: string;
|
|
32
|
-
}
|
|
33
|
-
interface Plan {
|
|
34
|
-
target: {
|
|
35
|
-
input: string;
|
|
36
|
-
normalizedEmail: string;
|
|
37
|
-
};
|
|
38
|
-
personUid: string | null;
|
|
39
|
-
cognitoUsers: PlanCognitoUser[];
|
|
40
|
-
ownedCompanies: PlanCompany[];
|
|
41
|
-
/** Present only when the request opted in to the handoff. */
|
|
42
|
-
sharedCompanyHandoffs?: PlanCompanyHandoff[];
|
|
43
|
-
personalVault: {
|
|
44
|
-
bucketName: string | null;
|
|
45
|
-
kmsKeyAlias: string | null;
|
|
46
|
-
};
|
|
47
|
-
stripe: {
|
|
48
|
-
customerIds: string[];
|
|
49
|
-
subscriptionState: unknown | null;
|
|
50
|
-
};
|
|
51
|
-
welcomeSeries: {
|
|
52
|
-
present: boolean;
|
|
53
|
-
};
|
|
54
|
-
workMesh: {
|
|
55
|
-
eventCount: number | null;
|
|
56
|
-
note?: string;
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
interface StepOutcome {
|
|
60
|
-
ok: boolean;
|
|
61
|
-
skipped?: boolean;
|
|
62
|
-
reason?: string;
|
|
63
|
-
error?: string;
|
|
64
|
-
}
|
|
65
|
-
interface ExecuteResult {
|
|
66
|
-
ok: boolean;
|
|
67
|
-
steps: Record<string, StepOutcome & Record<string, unknown>>;
|
|
68
|
-
counts: {
|
|
69
|
-
stripeDeleted: number;
|
|
70
|
-
welcomeDeleted: number;
|
|
71
|
-
rawTelemetryDeleted: number | null;
|
|
72
|
-
workMeshDeleted: number | null;
|
|
73
|
-
membershipsDeleted: number;
|
|
74
|
-
companiesPurged: number;
|
|
75
|
-
entitiesPurged: number;
|
|
76
|
-
cognitoDeleted: number;
|
|
77
|
-
kms: string;
|
|
78
|
-
invitesDeleted: number;
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Same predicate the server's admin gate applies at the FIRST layer
|
|
83
|
-
* (`isStaffEmail` in the vault-service admin handler). Duplicated here so a
|
|
84
|
-
* non-staff caller stops before the round trip; the server remains the
|
|
85
|
-
* authorization boundary (this file could not enforce it if it wanted to).
|
|
86
|
-
*
|
|
87
|
-
* The domain list matches the server's `SUPER_ADMIN_DOMAINS` (getindigo.ai,
|
|
88
|
-
* hqforwork.com, vyg.ai). Exact domain match: `foo@getindigo.ai.evil.test`
|
|
89
|
-
* and `bar@xgetindigo.ai` do not qualify.
|
|
90
|
-
*/
|
|
91
|
-
export declare function isStaffEmail(candidate: unknown): boolean;
|
|
92
|
-
/** Pull the caller email out of a locally cached id_token. */
|
|
93
|
-
export declare function callerEmailFromToken(token: string): string | undefined;
|
|
94
|
-
export type ConfirmFn = (question: string) => Promise<string>;
|
|
95
|
-
export interface RunResetTestAccountParams {
|
|
96
|
-
email: string;
|
|
97
|
-
execute: boolean;
|
|
98
|
-
/** Skip the typed-confirmation prompt on --execute (for scripts). */
|
|
99
|
-
yes?: boolean;
|
|
100
|
-
/** Keep a company with real members and hand it to one, instead of refusing. */
|
|
101
|
-
handoffSharedCompanies?: boolean;
|
|
102
|
-
}
|
|
103
|
-
export interface RunResetTestAccountDeps {
|
|
104
|
-
prompt?: ConfirmFn;
|
|
105
|
-
/** Whether to treat this session as an interactive TTY. Defaults to `process.stdin.isTTY`. */
|
|
106
|
-
isTty?: boolean;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Print a compact dry-run plan. Kept flat so the operator can eyeball what the
|
|
110
|
-
* executor would touch without a JSON pretty-printer in the loop.
|
|
111
|
-
*/
|
|
112
|
-
export declare function renderPlan(plan: Plan): string;
|
|
113
|
-
/**
|
|
114
|
-
* One-line-per-step summary of the executor's result. AC calls for "per-step
|
|
115
|
-
* counts, ok/failed".
|
|
116
|
-
*/
|
|
117
|
-
export declare function renderExecuteSummary(result: ExecuteResult): string;
|
|
118
|
-
export declare function runResetTestAccount(params: RunResetTestAccountParams, deps?: RunResetTestAccountDeps): Promise<void>;
|
|
119
|
-
export declare function registerResetTestAccountCommand(staff: Command, deps?: RunResetTestAccountDeps): Command;
|
|
120
|
-
export {};
|
|
121
|
-
//# sourceMappingURL=reset-test-account.d.ts.map
|