@runcofactor/cli 0.13.0 → 0.15.1
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/account-62I7FG5G.js +255 -0
- package/dist/account-62I7FG5G.js.map +1 -0
- package/dist/{api-catalog-7HLEN7C2.js → api-catalog-CAJUASVC.js} +5 -5
- package/dist/{attachment-OVNQD6Z2.js → attachment-RL4AZUJE.js} +5 -5
- package/dist/augmentor-GAF3MFY6.js +198 -0
- package/dist/augmentor-GAF3MFY6.js.map +1 -0
- package/dist/{auth-VUHL74FH.js → auth-DURHUZDW.js} +3 -3
- package/dist/{chunk-YN763NWQ.js → chunk-26U3DGUM.js} +10 -4
- package/dist/chunk-26U3DGUM.js.map +1 -0
- package/dist/{chunk-JZMJUPZP.js → chunk-32P26BZT.js} +3 -3
- package/dist/chunk-32P26BZT.js.map +1 -0
- package/dist/{chunk-QQVWGWPI.js → chunk-5R4HMSNX.js} +8561 -1511
- package/dist/chunk-5R4HMSNX.js.map +1 -0
- package/dist/{chunk-VGTKUOYS.js → chunk-AQPJQ5AE.js} +2 -2
- package/dist/{chunk-CQE46HSM.js → chunk-CFJXYPTF.js} +14 -8
- package/dist/chunk-CFJXYPTF.js.map +1 -0
- package/dist/{chunk-NL7CVG56.js → chunk-CJEKEW7R.js} +57 -10
- package/dist/chunk-CJEKEW7R.js.map +1 -0
- package/dist/{chunk-Z5LUTUDN.js → chunk-G5SXUXSU.js} +3 -3
- package/dist/{chunk-ZTOE3ND3.js → chunk-HKQ5XQAQ.js} +4 -4
- package/dist/{chunk-PZ4LCN6K.js → chunk-IGHDIWZU.js} +2 -2
- package/dist/{chunk-QGI4UCJX.js → chunk-IWKJQZJQ.js} +124 -74
- package/dist/chunk-IWKJQZJQ.js.map +1 -0
- package/dist/{chunk-ZD3KHESI.js → chunk-KRWRUU6R.js} +27 -7
- package/dist/chunk-KRWRUU6R.js.map +1 -0
- package/dist/{chunk-CRHPDPRS.js → chunk-PXFDH6YL.js} +63 -8
- package/dist/{chunk-CRHPDPRS.js.map → chunk-PXFDH6YL.js.map} +1 -1
- package/dist/{chunk-EJ4U242G.js → chunk-UZ2ZA5A6.js} +2 -2
- package/dist/{chunk-EEN2TZUQ.js → chunk-VKBTI5EF.js} +3 -3
- package/dist/{chunk-ENDHMYEJ.js → chunk-ZXRVFFCY.js} +3 -3
- package/dist/{credential-LO2SEEHU.js → credential-JGVSEGVH.js} +5 -5
- package/dist/{credential-template-ZN7W7734.js → credential-template-CWWMOKB2.js} +5 -5
- package/dist/{debug-workflow-R3RYYAXK.js → debug-workflow-BXRU72YZ.js} +5 -5
- package/dist/{docs-DIAFBDXQ.js → docs-PVBXPTGR.js} +95 -11
- package/dist/docs-PVBXPTGR.js.map +1 -0
- package/dist/{doctor-NZPUSCRE.js → doctor-RHMKD4W5.js} +3 -3
- package/dist/{environment-RQVU4P5M.js → environment-WZKIO3R3.js} +5 -5
- package/dist/{feature-flag-XG26RURR.js → feature-flag-K5REGGDY.js} +98 -12
- package/dist/feature-flag-K5REGGDY.js.map +1 -0
- package/dist/index.js +107 -51
- package/dist/index.js.map +1 -1
- package/dist/{init-EDNLKGPT.js → init-FFUZO5D7.js} +5 -5
- package/dist/{install-FYZ3HNZK.js → install-XRKEQAFZ.js} +5 -5
- package/dist/{issues-NNRVTJ4L.js → issues-I3V6GEXU.js} +5 -5
- package/dist/{knobs-A2BOBH22.js → knobs-6WLJMB44.js} +7 -6
- package/dist/knobs-6WLJMB44.js.map +1 -0
- package/dist/{list-F33VZ4BJ.js → list-PHC7VYNS.js} +5 -5
- package/dist/{local-DQDTM3XA.js → local-VGYRSW22.js} +7 -7
- package/dist/{login-BUMVIB36.js → login-QPU2BKG2.js} +5 -5
- package/dist/{mcp-B5Y5CDMQ.js → mcp-LA452TOA.js} +9 -9
- package/dist/{mcp-B5Y5CDMQ.js.map → mcp-LA452TOA.js.map} +1 -1
- package/dist/{pdf-extract-ABWV3L5X.js → pdf-extract-YHE54XU4.js} +2 -2
- package/dist/product-RSZV5HMB.js +346 -0
- package/dist/product-RSZV5HMB.js.map +1 -0
- package/dist/{property-NJ4SRXQG.js → property-YP4GHQAR.js} +5 -5
- package/dist/{psql-VBZFCMNR.js → psql-XGLBI6T7.js} +3 -3
- package/dist/{record-WAO36O7G.js → record-KWKHP2ZY.js} +6 -6
- package/dist/{redis-DHZXHL4S.js → redis-VJGCUJPV.js} +3 -3
- package/dist/redis-VJGCUJPV.js.map +1 -0
- package/dist/{release-STJKUKTE.js → release-NDRHPW6V.js} +5 -5
- package/dist/{sandbox-DWSGLY7B.js → sandbox-OOCANWOG.js} +51 -7
- package/dist/sandbox-OOCANWOG.js.map +1 -0
- package/dist/{scenarios-HCIDY725.js → scenarios-2HRLCGFY.js} +5 -5
- package/dist/{session-Y5RHU54D.js → session-M4ULYDYP.js} +8 -9
- package/dist/session-M4ULYDYP.js.map +1 -0
- package/dist/{skill-23WAHUOB.js → skill-4DGPRDUC.js} +10 -10
- package/dist/{skill-23WAHUOB.js.map → skill-4DGPRDUC.js.map} +1 -1
- package/dist/skills/debug-run/SKILL.md +7 -1
- package/dist/skills/debug-run/history/1.3.1.md +279 -0
- package/dist/skills/debug-run/version.json +1 -1
- package/dist/skills/optimize-cache/SKILL.md +41 -4
- package/dist/{spec-LM5XHOQ5.js → spec-XZ2TKUFZ.js} +5 -5
- package/dist/{src-BGDRMOKC.js → src-2FK3JHGW.js} +315 -104
- package/dist/src-2FK3JHGW.js.map +1 -0
- package/dist/{src-NCJPUAE6.js → src-CV57ZD6I.js} +10 -8
- package/dist/{src-22RI5VP2.js → src-HL7HEJIW.js} +2 -2
- package/dist/{src-Y3K7UJEF.js → src-OU7544PM.js} +6 -4
- package/dist/{start-SWY55CZX.js → start-IYKF3C3X.js} +5 -5
- package/dist/{tag-YSU2XXPI.js → tag-T45MMSCH.js} +6 -6
- package/dist/{task-NLBKLD7D.js → task-MCUHAVTD.js} +5 -5
- package/dist/{test-suite-QCPWZ2LS.js → test-suite-BICBRSBP.js} +10 -8
- package/dist/{test-suite-QCPWZ2LS.js.map → test-suite-BICBRSBP.js.map} +1 -1
- package/dist/trace-2BAPMYAS.js +16 -0
- package/dist/{triage-TT4BMDBU.js → triage-M3RZ2ASB.js} +6 -6
- package/dist/{upgrade-6ZUFETKX.js → upgrade-4QCRAUHP.js} +3 -3
- package/dist/{workflow-2CX3ZNOQ.js → workflow-4J23FV7K.js} +86 -15
- package/dist/workflow-4J23FV7K.js.map +1 -0
- package/dist/{workflow-cache-GXNE6SU2.js → workflow-cache-XPSK6KC7.js} +26 -13
- package/dist/workflow-cache-XPSK6KC7.js.map +1 -0
- package/dist/{workflow-debug-PRX3DWGD.js → workflow-debug-W4USZH35.js} +9 -9
- package/dist/{workflow-proposals-BW327WGL.js → workflow-proposals-5E3DTYZB.js} +5 -7
- package/dist/workflow-proposals-5E3DTYZB.js.map +1 -0
- package/package.json +5 -1
- package/dist/chunk-CQE46HSM.js.map +0 -1
- package/dist/chunk-JZMJUPZP.js.map +0 -1
- package/dist/chunk-NL7CVG56.js.map +0 -1
- package/dist/chunk-QGI4UCJX.js.map +0 -1
- package/dist/chunk-QQVWGWPI.js.map +0 -1
- package/dist/chunk-YN763NWQ.js.map +0 -1
- package/dist/chunk-ZD3KHESI.js.map +0 -1
- package/dist/docs-DIAFBDXQ.js.map +0 -1
- package/dist/feature-flag-XG26RURR.js.map +0 -1
- package/dist/knobs-A2BOBH22.js.map +0 -1
- package/dist/redis-DHZXHL4S.js.map +0 -1
- package/dist/sandbox-DWSGLY7B.js.map +0 -1
- package/dist/session-Y5RHU54D.js.map +0 -1
- package/dist/src-BGDRMOKC.js.map +0 -1
- package/dist/trace-A3ZY6K26.js +0 -16
- package/dist/workflow-2CX3ZNOQ.js.map +0 -1
- package/dist/workflow-cache-GXNE6SU2.js.map +0 -1
- package/dist/workflow-proposals-BW327WGL.js.map +0 -1
- /package/dist/{api-catalog-7HLEN7C2.js.map → api-catalog-CAJUASVC.js.map} +0 -0
- /package/dist/{attachment-OVNQD6Z2.js.map → attachment-RL4AZUJE.js.map} +0 -0
- /package/dist/{auth-VUHL74FH.js.map → auth-DURHUZDW.js.map} +0 -0
- /package/dist/{chunk-VGTKUOYS.js.map → chunk-AQPJQ5AE.js.map} +0 -0
- /package/dist/{chunk-Z5LUTUDN.js.map → chunk-G5SXUXSU.js.map} +0 -0
- /package/dist/{chunk-ZTOE3ND3.js.map → chunk-HKQ5XQAQ.js.map} +0 -0
- /package/dist/{chunk-PZ4LCN6K.js.map → chunk-IGHDIWZU.js.map} +0 -0
- /package/dist/{chunk-EJ4U242G.js.map → chunk-UZ2ZA5A6.js.map} +0 -0
- /package/dist/{chunk-EEN2TZUQ.js.map → chunk-VKBTI5EF.js.map} +0 -0
- /package/dist/{chunk-ENDHMYEJ.js.map → chunk-ZXRVFFCY.js.map} +0 -0
- /package/dist/{credential-LO2SEEHU.js.map → credential-JGVSEGVH.js.map} +0 -0
- /package/dist/{credential-template-ZN7W7734.js.map → credential-template-CWWMOKB2.js.map} +0 -0
- /package/dist/{debug-workflow-R3RYYAXK.js.map → debug-workflow-BXRU72YZ.js.map} +0 -0
- /package/dist/{doctor-NZPUSCRE.js.map → doctor-RHMKD4W5.js.map} +0 -0
- /package/dist/{environment-RQVU4P5M.js.map → environment-WZKIO3R3.js.map} +0 -0
- /package/dist/{init-EDNLKGPT.js.map → init-FFUZO5D7.js.map} +0 -0
- /package/dist/{install-FYZ3HNZK.js.map → install-XRKEQAFZ.js.map} +0 -0
- /package/dist/{issues-NNRVTJ4L.js.map → issues-I3V6GEXU.js.map} +0 -0
- /package/dist/{list-F33VZ4BJ.js.map → list-PHC7VYNS.js.map} +0 -0
- /package/dist/{local-DQDTM3XA.js.map → local-VGYRSW22.js.map} +0 -0
- /package/dist/{login-BUMVIB36.js.map → login-QPU2BKG2.js.map} +0 -0
- /package/dist/{pdf-extract-ABWV3L5X.js.map → pdf-extract-YHE54XU4.js.map} +0 -0
- /package/dist/{property-NJ4SRXQG.js.map → property-YP4GHQAR.js.map} +0 -0
- /package/dist/{psql-VBZFCMNR.js.map → psql-XGLBI6T7.js.map} +0 -0
- /package/dist/{record-WAO36O7G.js.map → record-KWKHP2ZY.js.map} +0 -0
- /package/dist/{release-STJKUKTE.js.map → release-NDRHPW6V.js.map} +0 -0
- /package/dist/{scenarios-HCIDY725.js.map → scenarios-2HRLCGFY.js.map} +0 -0
- /package/dist/{spec-LM5XHOQ5.js.map → spec-XZ2TKUFZ.js.map} +0 -0
- /package/dist/{src-NCJPUAE6.js.map → src-CV57ZD6I.js.map} +0 -0
- /package/dist/{src-22RI5VP2.js.map → src-HL7HEJIW.js.map} +0 -0
- /package/dist/{src-Y3K7UJEF.js.map → src-OU7544PM.js.map} +0 -0
- /package/dist/{start-SWY55CZX.js.map → start-IYKF3C3X.js.map} +0 -0
- /package/dist/{tag-YSU2XXPI.js.map → tag-T45MMSCH.js.map} +0 -0
- /package/dist/{task-NLBKLD7D.js.map → task-MCUHAVTD.js.map} +0 -0
- /package/dist/{trace-A3ZY6K26.js.map → trace-2BAPMYAS.js.map} +0 -0
- /package/dist/{triage-TT4BMDBU.js.map → triage-M3RZ2ASB.js.map} +0 -0
- /package/dist/{upgrade-6ZUFETKX.js.map → upgrade-4QCRAUHP.js.map} +0 -0
- /package/dist/{workflow-debug-PRX3DWGD.js.map → workflow-debug-W4USZH35.js.map} +0 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { createRequire as __cr } from "module"; const require = __cr(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
apiRequest,
|
|
4
|
+
fetchList
|
|
5
|
+
} from "./chunk-CFJXYPTF.js";
|
|
6
|
+
import "./chunk-3CZU7XCS.js";
|
|
7
|
+
import {
|
|
8
|
+
getArgValue,
|
|
9
|
+
hasFlag,
|
|
10
|
+
resolveConfig
|
|
11
|
+
} from "./chunk-IGHDIWZU.js";
|
|
12
|
+
import "./chunk-32P26BZT.js";
|
|
13
|
+
import "./chunk-JWHYXEA2.js";
|
|
14
|
+
import "./chunk-IWKJQZJQ.js";
|
|
15
|
+
import "./chunk-VKVL7WBN.js";
|
|
16
|
+
|
|
17
|
+
// src/account.ts
|
|
18
|
+
import process from "process";
|
|
19
|
+
var STAGES = ["prospect", "qualified", "engaged", "trial", "active", "churned"];
|
|
20
|
+
function formatAccount(account) {
|
|
21
|
+
const linked = account.linkedOrg ? ` org=${account.linkedOrg.name}` : "";
|
|
22
|
+
return ` ${account.id} ${account.title} (stage=${account.stage})${linked}`;
|
|
23
|
+
}
|
|
24
|
+
async function handleList(argv, apiUrl, token) {
|
|
25
|
+
const jsonOutput = hasFlag(argv, "--json");
|
|
26
|
+
const params = new URLSearchParams();
|
|
27
|
+
const search = getArgValue(argv, "--search");
|
|
28
|
+
if (search) params.set("search", search);
|
|
29
|
+
const stage = getArgValue(argv, "--stage");
|
|
30
|
+
if (stage) params.set("stage", stage);
|
|
31
|
+
const query = params.toString();
|
|
32
|
+
const path = `/superadmin/account-board/accounts${query ? `?${query}` : ""}`;
|
|
33
|
+
const accounts = await fetchList(apiUrl, token, path, "accounts");
|
|
34
|
+
if (jsonOutput) {
|
|
35
|
+
console.log(JSON.stringify(accounts, null, 2));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (accounts.length === 0) {
|
|
39
|
+
console.log("No accounts found.");
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
for (const account of accounts) console.log(formatAccount(account));
|
|
43
|
+
}
|
|
44
|
+
async function handleCreate(argv, apiUrl, token) {
|
|
45
|
+
const title = argv[0];
|
|
46
|
+
if (!title || title.startsWith("--")) {
|
|
47
|
+
console.error("Error: Missing account name.");
|
|
48
|
+
console.error("Usage: canary account create <name> [--description <text>] [--stage <stage>]");
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
const description = getArgValue(argv, "--description");
|
|
52
|
+
const stage = getArgValue(argv, "--stage");
|
|
53
|
+
const result = await apiRequest(
|
|
54
|
+
apiUrl,
|
|
55
|
+
token,
|
|
56
|
+
"POST",
|
|
57
|
+
"/superadmin/account-board/accounts",
|
|
58
|
+
{
|
|
59
|
+
title,
|
|
60
|
+
...description !== void 0 ? { description } : {},
|
|
61
|
+
...stage !== void 0 ? { stage } : {}
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
if (!result.ok || !result.account) {
|
|
65
|
+
console.error(`Error: ${result.error ?? "Failed to create account"}`);
|
|
66
|
+
process.exit(1);
|
|
67
|
+
}
|
|
68
|
+
console.log(`Created account ${result.account.id}: ${result.account.title} (stage=${result.account.stage})`);
|
|
69
|
+
}
|
|
70
|
+
async function handleSet(argv, apiUrl, token) {
|
|
71
|
+
const id = argv[0];
|
|
72
|
+
if (!id || id.startsWith("--")) {
|
|
73
|
+
console.error("Error: Missing account id.");
|
|
74
|
+
console.error("Usage: canary account set <id> [--title <text>] [--description <text>] [--stage <stage>]");
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
const title = getArgValue(argv, "--title");
|
|
78
|
+
const description = getArgValue(argv, "--description");
|
|
79
|
+
const stage = getArgValue(argv, "--stage");
|
|
80
|
+
if (title === void 0 && description === void 0 && stage === void 0) {
|
|
81
|
+
console.error("Error: Provide at least one of --title, --description, --stage.");
|
|
82
|
+
process.exit(1);
|
|
83
|
+
}
|
|
84
|
+
const result = await apiRequest(
|
|
85
|
+
apiUrl,
|
|
86
|
+
token,
|
|
87
|
+
"PATCH",
|
|
88
|
+
`/superadmin/account-board/accounts/${encodeURIComponent(id)}`,
|
|
89
|
+
{
|
|
90
|
+
...title !== void 0 ? { title } : {},
|
|
91
|
+
...description !== void 0 ? { description } : {},
|
|
92
|
+
...stage !== void 0 ? { stage } : {}
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
if (!result.ok || !result.account) {
|
|
96
|
+
console.error(`Error: ${result.error ?? "Failed to update account"}`);
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
99
|
+
console.log(`Updated account ${result.account.id}: ${result.account.title}`);
|
|
100
|
+
}
|
|
101
|
+
async function handleDelete(argv, apiUrl, token) {
|
|
102
|
+
const id = argv[0];
|
|
103
|
+
if (!id || id.startsWith("--")) {
|
|
104
|
+
console.error("Error: Missing account id.");
|
|
105
|
+
console.error("Usage: canary account delete <id>");
|
|
106
|
+
process.exit(1);
|
|
107
|
+
}
|
|
108
|
+
const result = await apiRequest(
|
|
109
|
+
apiUrl,
|
|
110
|
+
token,
|
|
111
|
+
"DELETE",
|
|
112
|
+
`/superadmin/account-board/accounts/${encodeURIComponent(id)}`
|
|
113
|
+
);
|
|
114
|
+
if (!result.ok) {
|
|
115
|
+
console.error(`Error: ${result.error}`);
|
|
116
|
+
process.exit(1);
|
|
117
|
+
}
|
|
118
|
+
console.log(`Deleted account ${id}`);
|
|
119
|
+
}
|
|
120
|
+
async function handleLinkOrg(argv, apiUrl, token) {
|
|
121
|
+
const id = argv[0];
|
|
122
|
+
const orgId = getArgValue(argv, "--org");
|
|
123
|
+
if (!id || id.startsWith("--")) {
|
|
124
|
+
console.error("Error: Missing account id.");
|
|
125
|
+
console.error("Usage: canary account link-org <id> --org <customerOrgId>");
|
|
126
|
+
process.exit(1);
|
|
127
|
+
}
|
|
128
|
+
if (!orgId) {
|
|
129
|
+
console.error("Error: --org <customerOrgId> is required.");
|
|
130
|
+
process.exit(1);
|
|
131
|
+
}
|
|
132
|
+
const result = await apiRequest(
|
|
133
|
+
apiUrl,
|
|
134
|
+
token,
|
|
135
|
+
"PUT",
|
|
136
|
+
`/superadmin/account-board/accounts/${encodeURIComponent(id)}/linked-org`,
|
|
137
|
+
{ customerOrgId: orgId }
|
|
138
|
+
);
|
|
139
|
+
if (!result.ok || !result.linkedOrg) {
|
|
140
|
+
console.error(`Error: ${result.error ?? "Failed to link org"}`);
|
|
141
|
+
process.exit(1);
|
|
142
|
+
}
|
|
143
|
+
console.log(`Linked account ${id} to org ${result.linkedOrg.name} (${result.linkedOrg.id})`);
|
|
144
|
+
}
|
|
145
|
+
async function handleUnlinkOrg(argv, apiUrl, token) {
|
|
146
|
+
const id = argv[0];
|
|
147
|
+
if (!id || id.startsWith("--")) {
|
|
148
|
+
console.error("Error: Missing account id.");
|
|
149
|
+
console.error("Usage: canary account unlink-org <id>");
|
|
150
|
+
process.exit(1);
|
|
151
|
+
}
|
|
152
|
+
const result = await apiRequest(
|
|
153
|
+
apiUrl,
|
|
154
|
+
token,
|
|
155
|
+
"DELETE",
|
|
156
|
+
`/superadmin/account-board/accounts/${encodeURIComponent(id)}/linked-org`
|
|
157
|
+
);
|
|
158
|
+
if (!result.ok) {
|
|
159
|
+
console.error(`Error: ${result.error}`);
|
|
160
|
+
process.exit(1);
|
|
161
|
+
}
|
|
162
|
+
console.log(`Unlinked org from account ${id}`);
|
|
163
|
+
}
|
|
164
|
+
async function handleLinkedOrg(argv, apiUrl, token) {
|
|
165
|
+
const id = argv[0];
|
|
166
|
+
const jsonOutput = hasFlag(argv, "--json");
|
|
167
|
+
if (!id || id.startsWith("--")) {
|
|
168
|
+
console.error("Usage: canary account linked-org <id>");
|
|
169
|
+
process.exit(1);
|
|
170
|
+
}
|
|
171
|
+
const result = await apiRequest(
|
|
172
|
+
apiUrl,
|
|
173
|
+
token,
|
|
174
|
+
"GET",
|
|
175
|
+
`/superadmin/account-board/accounts/${encodeURIComponent(id)}/linked-org`
|
|
176
|
+
);
|
|
177
|
+
if (!result.ok) {
|
|
178
|
+
console.error(`Error: ${result.error}`);
|
|
179
|
+
process.exit(1);
|
|
180
|
+
}
|
|
181
|
+
if (jsonOutput) {
|
|
182
|
+
console.log(JSON.stringify(result.linkedOrg ?? null, null, 2));
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
console.log(
|
|
186
|
+
result.linkedOrg ? `Account ${id} linked to org ${result.linkedOrg.name} (${result.linkedOrg.id})` : `Account ${id} has no linked org.`
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
function printAccountHelp() {
|
|
190
|
+
console.log(
|
|
191
|
+
[
|
|
192
|
+
"Usage: canary account <sub-command> [options]",
|
|
193
|
+
"",
|
|
194
|
+
"Manage the Accounts board (cards.boardType=account) for the org you are logged into.",
|
|
195
|
+
"",
|
|
196
|
+
"Sub-commands:",
|
|
197
|
+
" list [--search <text>] [--stage <stage>] [--json] List accounts",
|
|
198
|
+
" create <name> [--description <text>] [--stage <stage>]",
|
|
199
|
+
" Create an account (defaults to stage=prospect)",
|
|
200
|
+
" set <id> [--title <text>] [--description <text>] [--stage <stage>]",
|
|
201
|
+
" Update an account's fields",
|
|
202
|
+
" delete <id> Delete an account",
|
|
203
|
+
" link-org <id> --org <customerOrgId> Bind the account to a customer organization",
|
|
204
|
+
" unlink-org <id> Remove the account's org link",
|
|
205
|
+
" linked-org <id> [--json] Show the account's linked org",
|
|
206
|
+
"",
|
|
207
|
+
`Stages: ${STAGES.join(", ")}`,
|
|
208
|
+
"",
|
|
209
|
+
"Options:",
|
|
210
|
+
" --env <env> Target environment (prod, dev, local)",
|
|
211
|
+
" --json Output as JSON (list/linked-org only)",
|
|
212
|
+
" --api-url <url> API URL override (takes precedence over --env)",
|
|
213
|
+
" --token <key> API token override"
|
|
214
|
+
].join("\n")
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
async function runAccount(argv) {
|
|
218
|
+
const [subCommand, ...rest] = argv;
|
|
219
|
+
if (!subCommand || subCommand === "help" || hasFlag(argv, "--help", "-h")) {
|
|
220
|
+
printAccountHelp();
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
const { apiUrl, token } = await resolveConfig(argv);
|
|
224
|
+
switch (subCommand) {
|
|
225
|
+
case "list":
|
|
226
|
+
await handleList(rest, apiUrl, token);
|
|
227
|
+
break;
|
|
228
|
+
case "create":
|
|
229
|
+
await handleCreate(rest, apiUrl, token);
|
|
230
|
+
break;
|
|
231
|
+
case "set":
|
|
232
|
+
await handleSet(rest, apiUrl, token);
|
|
233
|
+
break;
|
|
234
|
+
case "delete":
|
|
235
|
+
await handleDelete(rest, apiUrl, token);
|
|
236
|
+
break;
|
|
237
|
+
case "link-org":
|
|
238
|
+
await handleLinkOrg(rest, apiUrl, token);
|
|
239
|
+
break;
|
|
240
|
+
case "unlink-org":
|
|
241
|
+
await handleUnlinkOrg(rest, apiUrl, token);
|
|
242
|
+
break;
|
|
243
|
+
case "linked-org":
|
|
244
|
+
await handleLinkedOrg(rest, apiUrl, token);
|
|
245
|
+
break;
|
|
246
|
+
default:
|
|
247
|
+
console.error(`Unknown sub-command: ${subCommand}`);
|
|
248
|
+
printAccountHelp();
|
|
249
|
+
process.exit(1);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
export {
|
|
253
|
+
runAccount
|
|
254
|
+
};
|
|
255
|
+
//# sourceMappingURL=account-62I7FG5G.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/account.ts"],"sourcesContent":["/**\n * CLI Account Board Management\n *\n * Superadmin CRUD for the Accounts board (cards.boardType='account') and the\n * account↔customer-org link, scoped to the org the CLI user is logged into.\n * Backed by `/superadmin/account-board/*`.\n */\n\nimport process from 'node:process';\nimport { resolveConfig, getArgValue, hasFlag } from './auth.js';\nimport { apiRequest, fetchList } from './cli-helpers.js';\n\ntype LinkedOrgRef = { id: string; name: string };\n\ntype Account = {\n id: string;\n title: string;\n description: string;\n stage: string;\n sortOrder: number;\n linkedOrg: LinkedOrgRef | null;\n};\n\ntype AccountApiResponse = {\n ok: boolean;\n error?: string;\n account?: Account;\n linkedOrg?: LinkedOrgRef | null;\n};\n\nconst STAGES = ['prospect', 'qualified', 'engaged', 'trial', 'active', 'churned'];\n\nfunction formatAccount(account: Account): string {\n const linked = account.linkedOrg ? ` org=${account.linkedOrg.name}` : '';\n return ` ${account.id} ${account.title} (stage=${account.stage})${linked}`;\n}\n\nasync function handleList(argv: string[], apiUrl: string, token: string): Promise<void> {\n const jsonOutput = hasFlag(argv, '--json');\n const params = new URLSearchParams();\n const search = getArgValue(argv, '--search');\n if (search) params.set('search', search);\n const stage = getArgValue(argv, '--stage');\n if (stage) params.set('stage', stage);\n const query = params.toString();\n const path = `/superadmin/account-board/accounts${query ? `?${query}` : ''}`;\n const accounts = await fetchList<Account>(apiUrl, token, path, 'accounts');\n\n if (jsonOutput) {\n console.log(JSON.stringify(accounts, null, 2));\n return;\n }\n if (accounts.length === 0) {\n console.log('No accounts found.');\n return;\n }\n for (const account of accounts) console.log(formatAccount(account));\n}\n\nasync function handleCreate(argv: string[], apiUrl: string, token: string): Promise<void> {\n const title = argv[0];\n if (!title || title.startsWith('--')) {\n console.error('Error: Missing account name.');\n console.error('Usage: canary account create <name> [--description <text>] [--stage <stage>]');\n process.exit(1);\n }\n\n const description = getArgValue(argv, '--description');\n const stage = getArgValue(argv, '--stage');\n\n const result = await apiRequest<AccountApiResponse>(\n apiUrl,\n token,\n 'POST',\n '/superadmin/account-board/accounts',\n {\n title,\n ...(description !== undefined ? { description } : {}),\n ...(stage !== undefined ? { stage } : {}),\n }\n );\n\n if (!result.ok || !result.account) {\n console.error(`Error: ${result.error ?? 'Failed to create account'}`);\n process.exit(1);\n }\n console.log(`Created account ${result.account.id}: ${result.account.title} (stage=${result.account.stage})`);\n}\n\nasync function handleSet(argv: string[], apiUrl: string, token: string): Promise<void> {\n const id = argv[0];\n if (!id || id.startsWith('--')) {\n console.error('Error: Missing account id.');\n console.error('Usage: canary account set <id> [--title <text>] [--description <text>] [--stage <stage>]');\n process.exit(1);\n }\n\n const title = getArgValue(argv, '--title');\n const description = getArgValue(argv, '--description');\n const stage = getArgValue(argv, '--stage');\n\n if (title === undefined && description === undefined && stage === undefined) {\n console.error('Error: Provide at least one of --title, --description, --stage.');\n process.exit(1);\n }\n\n const result = await apiRequest<AccountApiResponse>(\n apiUrl,\n token,\n 'PATCH',\n `/superadmin/account-board/accounts/${encodeURIComponent(id)}`,\n {\n ...(title !== undefined ? { title } : {}),\n ...(description !== undefined ? { description } : {}),\n ...(stage !== undefined ? { stage } : {}),\n }\n );\n\n if (!result.ok || !result.account) {\n console.error(`Error: ${result.error ?? 'Failed to update account'}`);\n process.exit(1);\n }\n console.log(`Updated account ${result.account.id}: ${result.account.title}`);\n}\n\nasync function handleDelete(argv: string[], apiUrl: string, token: string): Promise<void> {\n const id = argv[0];\n if (!id || id.startsWith('--')) {\n console.error('Error: Missing account id.');\n console.error('Usage: canary account delete <id>');\n process.exit(1);\n }\n\n const result = await apiRequest<AccountApiResponse>(\n apiUrl,\n token,\n 'DELETE',\n `/superadmin/account-board/accounts/${encodeURIComponent(id)}`\n );\n\n if (!result.ok) {\n console.error(`Error: ${result.error}`);\n process.exit(1);\n }\n console.log(`Deleted account ${id}`);\n}\n\nasync function handleLinkOrg(argv: string[], apiUrl: string, token: string): Promise<void> {\n const id = argv[0];\n const orgId = getArgValue(argv, '--org');\n if (!id || id.startsWith('--')) {\n console.error('Error: Missing account id.');\n console.error('Usage: canary account link-org <id> --org <customerOrgId>');\n process.exit(1);\n }\n if (!orgId) {\n console.error('Error: --org <customerOrgId> is required.');\n process.exit(1);\n }\n\n const result = await apiRequest<AccountApiResponse>(\n apiUrl,\n token,\n 'PUT',\n `/superadmin/account-board/accounts/${encodeURIComponent(id)}/linked-org`,\n { customerOrgId: orgId }\n );\n\n if (!result.ok || !result.linkedOrg) {\n console.error(`Error: ${result.error ?? 'Failed to link org'}`);\n process.exit(1);\n }\n console.log(`Linked account ${id} to org ${result.linkedOrg.name} (${result.linkedOrg.id})`);\n}\n\nasync function handleUnlinkOrg(argv: string[], apiUrl: string, token: string): Promise<void> {\n const id = argv[0];\n if (!id || id.startsWith('--')) {\n console.error('Error: Missing account id.');\n console.error('Usage: canary account unlink-org <id>');\n process.exit(1);\n }\n\n const result = await apiRequest<AccountApiResponse>(\n apiUrl,\n token,\n 'DELETE',\n `/superadmin/account-board/accounts/${encodeURIComponent(id)}/linked-org`\n );\n\n if (!result.ok) {\n console.error(`Error: ${result.error}`);\n process.exit(1);\n }\n console.log(`Unlinked org from account ${id}`);\n}\n\nasync function handleLinkedOrg(argv: string[], apiUrl: string, token: string): Promise<void> {\n const id = argv[0];\n const jsonOutput = hasFlag(argv, '--json');\n if (!id || id.startsWith('--')) {\n console.error('Usage: canary account linked-org <id>');\n process.exit(1);\n }\n\n const result = await apiRequest<AccountApiResponse>(\n apiUrl,\n token,\n 'GET',\n `/superadmin/account-board/accounts/${encodeURIComponent(id)}/linked-org`\n );\n\n if (!result.ok) {\n console.error(`Error: ${result.error}`);\n process.exit(1);\n }\n if (jsonOutput) {\n console.log(JSON.stringify(result.linkedOrg ?? null, null, 2));\n return;\n }\n console.log(\n result.linkedOrg\n ? `Account ${id} linked to org ${result.linkedOrg.name} (${result.linkedOrg.id})`\n : `Account ${id} has no linked org.`\n );\n}\n\nfunction printAccountHelp(): void {\n console.log(\n [\n 'Usage: canary account <sub-command> [options]',\n '',\n 'Manage the Accounts board (cards.boardType=account) for the org you are logged into.',\n '',\n 'Sub-commands:',\n ' list [--search <text>] [--stage <stage>] [--json] List accounts',\n ' create <name> [--description <text>] [--stage <stage>]',\n ' Create an account (defaults to stage=prospect)',\n ' set <id> [--title <text>] [--description <text>] [--stage <stage>]',\n ' Update an account\\'s fields',\n ' delete <id> Delete an account',\n ' link-org <id> --org <customerOrgId> Bind the account to a customer organization',\n ' unlink-org <id> Remove the account\\'s org link',\n ' linked-org <id> [--json] Show the account\\'s linked org',\n '',\n `Stages: ${STAGES.join(', ')}`,\n '',\n 'Options:',\n ' --env <env> Target environment (prod, dev, local)',\n ' --json Output as JSON (list/linked-org only)',\n ' --api-url <url> API URL override (takes precedence over --env)',\n ' --token <key> API token override',\n ].join('\\n')\n );\n}\n\nexport async function runAccount(argv: string[]): Promise<void> {\n const [subCommand, ...rest] = argv;\n\n if (!subCommand || subCommand === 'help' || hasFlag(argv, '--help', '-h')) {\n printAccountHelp();\n return;\n }\n\n const { apiUrl, token } = await resolveConfig(argv);\n\n switch (subCommand) {\n case 'list':\n await handleList(rest, apiUrl, token);\n break;\n case 'create':\n await handleCreate(rest, apiUrl, token);\n break;\n case 'set':\n await handleSet(rest, apiUrl, token);\n break;\n case 'delete':\n await handleDelete(rest, apiUrl, token);\n break;\n case 'link-org':\n await handleLinkOrg(rest, apiUrl, token);\n break;\n case 'unlink-org':\n await handleUnlinkOrg(rest, apiUrl, token);\n break;\n case 'linked-org':\n await handleLinkedOrg(rest, apiUrl, token);\n break;\n default:\n console.error(`Unknown sub-command: ${subCommand}`);\n printAccountHelp();\n process.exit(1);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAQA,OAAO,aAAa;AAsBpB,IAAM,SAAS,CAAC,YAAY,aAAa,WAAW,SAAS,UAAU,SAAS;AAEhF,SAAS,cAAc,SAA0B;AAC/C,QAAM,SAAS,QAAQ,YAAY,QAAQ,QAAQ,UAAU,IAAI,KAAK;AACtE,SAAO,KAAK,QAAQ,EAAE,KAAK,QAAQ,KAAK,YAAY,QAAQ,KAAK,IAAI,MAAM;AAC7E;AAEA,eAAe,WAAW,MAAgB,QAAgB,OAA8B;AACtF,QAAM,aAAa,QAAQ,MAAM,QAAQ;AACzC,QAAM,SAAS,IAAI,gBAAgB;AACnC,QAAM,SAAS,YAAY,MAAM,UAAU;AAC3C,MAAI,OAAQ,QAAO,IAAI,UAAU,MAAM;AACvC,QAAM,QAAQ,YAAY,MAAM,SAAS;AACzC,MAAI,MAAO,QAAO,IAAI,SAAS,KAAK;AACpC,QAAM,QAAQ,OAAO,SAAS;AAC9B,QAAM,OAAO,qCAAqC,QAAQ,IAAI,KAAK,KAAK,EAAE;AAC1E,QAAM,WAAW,MAAM,UAAmB,QAAQ,OAAO,MAAM,UAAU;AAEzE,MAAI,YAAY;AACd,YAAQ,IAAI,KAAK,UAAU,UAAU,MAAM,CAAC,CAAC;AAC7C;AAAA,EACF;AACA,MAAI,SAAS,WAAW,GAAG;AACzB,YAAQ,IAAI,oBAAoB;AAChC;AAAA,EACF;AACA,aAAW,WAAW,SAAU,SAAQ,IAAI,cAAc,OAAO,CAAC;AACpE;AAEA,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AM,cAAc,MAAM,QAAQ,KAAK;AACvC;AAAA,IACF,KAAK;AACH,YAAM,gBAAgB,MAAM,QAAQ,KAAK;AACzC;AAAA,IACF,KAAK;AACH,YAAM,gBAAgB,MAAM,QAAQ,KAAK;AACzC;AAAA,IACF;AACE,cAAQ,MAAM,wBAAwB,UAAU,EAAE;AAClD,uBAAiB;AACjB,cAAQ,KAAK,CAAC;AAAA,EAClB;AACF;","names":[]}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { createRequire as __cr } from "module"; const require = __cr(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
apiRequest
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CFJXYPTF.js";
|
|
5
5
|
import "./chunk-3CZU7XCS.js";
|
|
6
6
|
import {
|
|
7
7
|
getArgValue,
|
|
8
8
|
hasFlag
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-IGHDIWZU.js";
|
|
10
|
+
import "./chunk-32P26BZT.js";
|
|
11
11
|
import "./chunk-JWHYXEA2.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-IWKJQZJQ.js";
|
|
13
13
|
import "./chunk-VKVL7WBN.js";
|
|
14
14
|
|
|
15
15
|
// src/api-catalog.ts
|
|
@@ -399,4 +399,4 @@ function exitErr(msg) {
|
|
|
399
399
|
export {
|
|
400
400
|
runApiCatalog
|
|
401
401
|
};
|
|
402
|
-
//# sourceMappingURL=api-catalog-
|
|
402
|
+
//# sourceMappingURL=api-catalog-CAJUASVC.js.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { createRequire as __cr } from "module"; const require = __cr(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
apiRequest
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CFJXYPTF.js";
|
|
5
5
|
import "./chunk-3CZU7XCS.js";
|
|
6
6
|
import {
|
|
7
7
|
getArgValue,
|
|
8
8
|
hasFlag,
|
|
9
9
|
resolveConfig
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-IGHDIWZU.js";
|
|
11
|
+
import "./chunk-32P26BZT.js";
|
|
12
12
|
import "./chunk-JWHYXEA2.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-IWKJQZJQ.js";
|
|
14
14
|
import "./chunk-VKVL7WBN.js";
|
|
15
15
|
|
|
16
16
|
// src/attachment.ts
|
|
@@ -274,4 +274,4 @@ async function runAttachment(argv) {
|
|
|
274
274
|
export {
|
|
275
275
|
runAttachment
|
|
276
276
|
};
|
|
277
|
-
//# sourceMappingURL=attachment-
|
|
277
|
+
//# sourceMappingURL=attachment-RL4AZUJE.js.map
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { createRequire as __cr } from "module"; const require = __cr(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
apiRequest,
|
|
4
|
+
getApplicationArg
|
|
5
|
+
} from "./chunk-CFJXYPTF.js";
|
|
6
|
+
import "./chunk-3CZU7XCS.js";
|
|
7
|
+
import {
|
|
8
|
+
getArgValue
|
|
9
|
+
} from "./chunk-IGHDIWZU.js";
|
|
10
|
+
import "./chunk-32P26BZT.js";
|
|
11
|
+
import "./chunk-JWHYXEA2.js";
|
|
12
|
+
import "./chunk-IWKJQZJQ.js";
|
|
13
|
+
import "./chunk-VKVL7WBN.js";
|
|
14
|
+
|
|
15
|
+
// src/augmentor.ts
|
|
16
|
+
import process from "process";
|
|
17
|
+
function fail(message) {
|
|
18
|
+
console.error(`Error: ${message}`);
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
function requireApplication(argv) {
|
|
22
|
+
const id = getApplicationArg(argv);
|
|
23
|
+
if (!id) fail("--application <propertyId> is required");
|
|
24
|
+
return id;
|
|
25
|
+
}
|
|
26
|
+
function requireId(argv) {
|
|
27
|
+
const id = getArgValue(argv, "--id");
|
|
28
|
+
if (!id) fail("--id <augmentorId> is required");
|
|
29
|
+
return id;
|
|
30
|
+
}
|
|
31
|
+
function printGuide() {
|
|
32
|
+
console.log(`canary augmentor \u2014 manage a property's custom augmentors
|
|
33
|
+
|
|
34
|
+
Usage:
|
|
35
|
+
canary augmentor list --application <propertyId> [--status active|disabled|stale|needs_reauthoring] [--format table|json]
|
|
36
|
+
canary augmentor get --id <augmentorId> [--format table|json]
|
|
37
|
+
canary augmentor stats --application <propertyId> [--format table|json]
|
|
38
|
+
canary augmentor signals --application <propertyId> [--format table|json] # pending authoring queue
|
|
39
|
+
canary augmentor disable --id <augmentorId> [--reason "<text>"] # operator kill-switch
|
|
40
|
+
canary augmentor enable --id <augmentorId> # re-enable
|
|
41
|
+
|
|
42
|
+
Authoring is automatic: a ref-less coordinate click in a run queues a detection
|
|
43
|
+
signal that an offline agent turns into a verified augmentor. Use this CLI to
|
|
44
|
+
audit health and flip the operator kill-switch.`);
|
|
45
|
+
}
|
|
46
|
+
async function handleList(argv, apiUrl, token) {
|
|
47
|
+
const propertyId = requireApplication(argv);
|
|
48
|
+
const status = getArgValue(argv, "--status");
|
|
49
|
+
const json = getArgValue(argv, "--format") === "json";
|
|
50
|
+
const qs = status ? `?status=${encodeURIComponent(status)}` : "";
|
|
51
|
+
const res = await apiRequest(
|
|
52
|
+
apiUrl,
|
|
53
|
+
token,
|
|
54
|
+
"GET",
|
|
55
|
+
`/org/properties/${propertyId}/augmentors${qs}`
|
|
56
|
+
);
|
|
57
|
+
if (!res.ok) fail(res.error ?? "Unknown error");
|
|
58
|
+
const augmentors = res.data?.augmentors ?? [];
|
|
59
|
+
if (json) {
|
|
60
|
+
console.log(JSON.stringify(augmentors, null, 2));
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (augmentors.length === 0) {
|
|
64
|
+
console.log("No augmentors for this property.");
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
for (const a of augmentors) {
|
|
68
|
+
const health = a.enabled ? a.status : "disabled(operator)";
|
|
69
|
+
console.log(
|
|
70
|
+
`${a.id} [${health}] ${a.urlNorm}
|
|
71
|
+
selector: ${a.matchSelector}
|
|
72
|
+
triggers: ${a.triggerMatchCount} interactions: ${a.interactionCount} misses: ${a.consecutiveMissCount} source: ${a.sourceType}` + (a.invalidationReason ? `
|
|
73
|
+
invalidated: ${a.invalidationReason}` : "")
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
async function handleGet(argv, apiUrl, token) {
|
|
78
|
+
const id = requireId(argv);
|
|
79
|
+
const res = await apiRequest(apiUrl, token, "GET", `/org/augmentors/${id}`);
|
|
80
|
+
if (!res.ok) fail(res.error ?? "Unknown error");
|
|
81
|
+
const a = res.data?.augmentor;
|
|
82
|
+
if (!a) fail("Augmentor not found");
|
|
83
|
+
console.log(JSON.stringify(a, null, 2));
|
|
84
|
+
}
|
|
85
|
+
async function handleStats(argv, apiUrl, token) {
|
|
86
|
+
const propertyId = requireApplication(argv);
|
|
87
|
+
const json = getArgValue(argv, "--format") === "json";
|
|
88
|
+
const res = await apiRequest(
|
|
89
|
+
apiUrl,
|
|
90
|
+
token,
|
|
91
|
+
"GET",
|
|
92
|
+
`/org/properties/${propertyId}/augmentors`
|
|
93
|
+
);
|
|
94
|
+
if (!res.ok) fail(res.error ?? "Unknown error");
|
|
95
|
+
const augmentors = res.data?.augmentors ?? [];
|
|
96
|
+
const byStatus = {};
|
|
97
|
+
let totalTriggers = 0;
|
|
98
|
+
let totalInteractions = 0;
|
|
99
|
+
for (const a of augmentors) {
|
|
100
|
+
const key = a.enabled ? a.status : "disabled";
|
|
101
|
+
byStatus[key] = (byStatus[key] ?? 0) + 1;
|
|
102
|
+
totalTriggers += a.triggerMatchCount;
|
|
103
|
+
totalInteractions += a.interactionCount;
|
|
104
|
+
}
|
|
105
|
+
const stats = {
|
|
106
|
+
total: augmentors.length,
|
|
107
|
+
byStatus,
|
|
108
|
+
totalTriggers,
|
|
109
|
+
totalInteractions,
|
|
110
|
+
// The payoff ratio: how often a trigger led to the agent using the healed element.
|
|
111
|
+
interactionRate: totalTriggers > 0 ? +(totalInteractions / totalTriggers).toFixed(3) : 0
|
|
112
|
+
};
|
|
113
|
+
if (json) {
|
|
114
|
+
console.log(JSON.stringify(stats, null, 2));
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
console.log(`Augmentors for property ${propertyId}:`);
|
|
118
|
+
console.log(` total: ${stats.total}`);
|
|
119
|
+
for (const [k, v] of Object.entries(byStatus)) console.log(` ${k}: ${v}`);
|
|
120
|
+
console.log(` triggers: ${totalTriggers} interactions: ${totalInteractions} rate: ${stats.interactionRate}`);
|
|
121
|
+
}
|
|
122
|
+
async function handleSignals(argv, apiUrl, token) {
|
|
123
|
+
const propertyId = requireApplication(argv);
|
|
124
|
+
const json = getArgValue(argv, "--format") === "json";
|
|
125
|
+
const res = await apiRequest(
|
|
126
|
+
apiUrl,
|
|
127
|
+
token,
|
|
128
|
+
"GET",
|
|
129
|
+
`/org/properties/${propertyId}/augmentors/signals`
|
|
130
|
+
);
|
|
131
|
+
if (!res.ok) fail(res.error ?? "Unknown error");
|
|
132
|
+
const signals = res.data?.signals ?? [];
|
|
133
|
+
if (json) {
|
|
134
|
+
console.log(JSON.stringify(signals, null, 2));
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (signals.length === 0) {
|
|
138
|
+
console.log("No pending detection signals (authoring queue is empty).");
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
for (const s of signals) {
|
|
142
|
+
const coord = s.viewportX !== null && s.viewportY !== null ? `(${s.viewportX}, ${s.viewportY})` : "(no coord)";
|
|
143
|
+
console.log(`${s.id} [${s.source} ${coord}] ${s.urlNorm} \u2014 ${s.status}`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
async function handleDisable(argv, apiUrl, token) {
|
|
147
|
+
const id = requireId(argv);
|
|
148
|
+
const reason = getArgValue(argv, "--reason");
|
|
149
|
+
const res = await apiRequest(
|
|
150
|
+
apiUrl,
|
|
151
|
+
token,
|
|
152
|
+
"POST",
|
|
153
|
+
`/org/augmentors/${id}/disable`,
|
|
154
|
+
reason ? { reason } : void 0
|
|
155
|
+
);
|
|
156
|
+
if (!res.ok) fail(res.error ?? "Unknown error");
|
|
157
|
+
console.log(`Disabled augmentor ${id}.`);
|
|
158
|
+
}
|
|
159
|
+
async function handleEnable(argv, apiUrl, token) {
|
|
160
|
+
const id = requireId(argv);
|
|
161
|
+
const res = await apiRequest(apiUrl, token, "POST", `/org/augmentors/${id}/enable`);
|
|
162
|
+
if (!res.ok) fail(res.error ?? "Unknown error");
|
|
163
|
+
console.log(`Enabled augmentor ${id}.`);
|
|
164
|
+
}
|
|
165
|
+
async function runAugmentor(argv, apiUrl, token) {
|
|
166
|
+
const [action, ...rest] = argv;
|
|
167
|
+
switch (action) {
|
|
168
|
+
case void 0:
|
|
169
|
+
case "help":
|
|
170
|
+
case "--help":
|
|
171
|
+
printGuide();
|
|
172
|
+
return;
|
|
173
|
+
case "list":
|
|
174
|
+
await handleList(rest, apiUrl, token);
|
|
175
|
+
return;
|
|
176
|
+
case "get":
|
|
177
|
+
await handleGet(rest, apiUrl, token);
|
|
178
|
+
return;
|
|
179
|
+
case "stats":
|
|
180
|
+
await handleStats(rest, apiUrl, token);
|
|
181
|
+
return;
|
|
182
|
+
case "signals":
|
|
183
|
+
await handleSignals(rest, apiUrl, token);
|
|
184
|
+
return;
|
|
185
|
+
case "disable":
|
|
186
|
+
await handleDisable(rest, apiUrl, token);
|
|
187
|
+
return;
|
|
188
|
+
case "enable":
|
|
189
|
+
await handleEnable(rest, apiUrl, token);
|
|
190
|
+
return;
|
|
191
|
+
default:
|
|
192
|
+
fail(`Unknown augmentor command: ${action}. Run \`canary augmentor help\`.`);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
export {
|
|
196
|
+
runAugmentor
|
|
197
|
+
};
|
|
198
|
+
//# sourceMappingURL=augmentor-GAF3MFY6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/augmentor.ts"],"sourcesContent":["/**\n * CLI: `canary augmentor` — inspect & manage a property's custom augmentors\n *\n * Custom augmentors are persisted, customer-scoped collectors the cloud browser\n * agent runs before ariaSnapshot to heal semantic-snapshot blind spots (e.g. a\n * calendar of role-less <div> slots). They are authored AUTONOMOUSLY (a ref-less\n * coordinate click queues a detection signal → an offline authoring agent →\n * server-validated commit), so this CLI manages what that pipeline produces:\n * list/get, the operator enable/disable kill-switch, stats, and the pending\n * detection-signal queue.\n *\n * Thin client over the org-scoped /org/.../augmentors endpoints. Interactive and\n * flag-driven (every action has flags so agents can drive it from bash).\n */\n\nimport process from 'node:process';\nimport { getArgValue } from './auth.js';\nimport { apiRequest, getApplicationArg } from './cli-helpers.js';\n\ninterface Augmentor {\n id: string;\n propertyId: string;\n urlNorm: string;\n matchSelector: string;\n status: 'active' | 'disabled' | 'stale' | 'needs_reauthoring';\n enabled: boolean;\n sourceType: string;\n expectedMinCount: number;\n triggerMatchCount: number;\n consecutiveMissCount: number;\n interactionCount: number;\n lastTriggeredAt: string | null;\n lastInteractedAt: string | null;\n invalidationReason: string | null;\n createdAt: string;\n}\n\ninterface DetectionSignal {\n id: string;\n urlNorm: string;\n source: string;\n viewportX: number | null;\n viewportY: number | null;\n status: string;\n createdAt: string;\n}\n\ntype ListResponse = { ok: boolean; error?: string; data?: { augmentors: Augmentor[] } };\ntype GetResponse = { ok: boolean; error?: string; data?: { augmentor: Augmentor } };\ntype SignalsResponse = { ok: boolean; error?: string; data?: { signals: DetectionSignal[] } };\ntype MutateResponse = { ok: boolean; error?: string };\n\nfunction fail(message: string): never {\n console.error(`Error: ${message}`);\n process.exit(1);\n}\n\nfunction requireApplication(argv: string[]): string {\n const id = getApplicationArg(argv);\n if (!id) fail('--application <propertyId> is required');\n return id!;\n}\n\nfunction requireId(argv: string[]): string {\n const id = getArgValue(argv, '--id');\n if (!id) fail('--id <augmentorId> is required');\n return id!;\n}\n\nfunction printGuide(): void {\n console.log(`canary augmentor — manage a property's custom augmentors\n\nUsage:\n canary augmentor list --application <propertyId> [--status active|disabled|stale|needs_reauthoring] [--format table|json]\n canary augmentor get --id <augmentorId> [--format table|json]\n canary augmentor stats --application <propertyId> [--format table|json]\n canary augmentor signals --application <propertyId> [--format table|json] # pending authoring queue\n canary augmentor disable --id <augmentorId> [--reason \"<text>\"] # operator kill-switch\n canary augmentor enable --id <augmentorId> # re-enable\n\nAuthoring is automatic: a ref-less coordinate click in a run queues a detection\nsignal that an offline agent turns into a verified augmentor. Use this CLI to\naudit health and flip the operator kill-switch.`);\n}\n\nasync function handleList(argv: string[], apiUrl: string, token: string): Promise<void> {\n const propertyId = requireApplication(argv);\n const status = getArgValue(argv, '--status');\n const json = getArgValue(argv, '--format') === 'json';\n const qs = status ? `?status=${encodeURIComponent(status)}` : '';\n const res = await apiRequest<ListResponse>(\n apiUrl,\n token,\n 'GET',\n `/org/properties/${propertyId}/augmentors${qs}`\n );\n if (!res.ok) fail(res.error ?? 'Unknown error');\n const augmentors = res.data?.augmentors ?? [];\n if (json) {\n console.log(JSON.stringify(augmentors, null, 2));\n return;\n }\n if (augmentors.length === 0) {\n console.log('No augmentors for this property.');\n return;\n }\n for (const a of augmentors) {\n const health = a.enabled ? a.status : 'disabled(operator)';\n console.log(\n `${a.id} [${health}] ${a.urlNorm}\\n` +\n ` selector: ${a.matchSelector}\\n` +\n ` triggers: ${a.triggerMatchCount} interactions: ${a.interactionCount} ` +\n `misses: ${a.consecutiveMissCount} source: ${a.sourceType}` +\n (a.invalidationReason ? `\\n invalidated: ${a.invalidationReason}` : '')\n );\n }\n}\n\nasync function handleGet(argv: string[], apiUrl: string, token: string): Promise<void> {\n const id = requireId(argv);\n const res = await apiRequest<GetResponse>(apiUrl, token, 'GET', `/org/augmentors/${id}`);\n if (!res.ok) fail(res.error ?? 'Unknown error');\n const a = res.data?.augmentor;\n if (!a) fail('Augmentor not found');\n // A single augmentor is detail-dense — always pretty-print the full record.\n console.log(JSON.stringify(a, null, 2));\n}\n\nasync function handleStats(argv: string[], apiUrl: string, token: string): Promise<void> {\n const propertyId = requireApplication(argv);\n const json = getArgValue(argv, '--format') === 'json';\n const res = await apiRequest<ListResponse>(\n apiUrl,\n token,\n 'GET',\n `/org/properties/${propertyId}/augmentors`\n );\n if (!res.ok) fail(res.error ?? 'Unknown error');\n const augmentors = res.data?.augmentors ?? [];\n const byStatus: Record<string, number> = {};\n let totalTriggers = 0;\n let totalInteractions = 0;\n for (const a of augmentors) {\n const key = a.enabled ? a.status : 'disabled';\n byStatus[key] = (byStatus[key] ?? 0) + 1;\n totalTriggers += a.triggerMatchCount;\n totalInteractions += a.interactionCount;\n }\n const stats = {\n total: augmentors.length,\n byStatus,\n totalTriggers,\n totalInteractions,\n // The payoff ratio: how often a trigger led to the agent using the healed element.\n interactionRate: totalTriggers > 0 ? +(totalInteractions / totalTriggers).toFixed(3) : 0,\n };\n if (json) {\n console.log(JSON.stringify(stats, null, 2));\n return;\n }\n console.log(`Augmentors for property ${propertyId}:`);\n console.log(` total: ${stats.total}`);\n for (const [k, v] of Object.entries(byStatus)) console.log(` ${k}: ${v}`);\n console.log(` triggers: ${totalTriggers} interactions: ${totalInteractions} rate: ${stats.interactionRate}`);\n}\n\nasync function handleSignals(argv: string[], apiUrl: string, token: string): Promise<void> {\n const propertyId = requireApplication(argv);\n const json = getArgValue(argv, '--format') === 'json';\n const res = await apiRequest<SignalsResponse>(\n apiUrl,\n token,\n 'GET',\n `/org/properties/${propertyId}/augmentors/signals`\n );\n if (!res.ok) fail(res.error ?? 'Unknown error');\n const signals = res.data?.signals ?? [];\n if (json) {\n console.log(JSON.stringify(signals, null, 2));\n return;\n }\n if (signals.length === 0) {\n console.log('No pending detection signals (authoring queue is empty).');\n return;\n }\n for (const s of signals) {\n const coord = s.viewportX !== null && s.viewportY !== null ? `(${s.viewportX}, ${s.viewportY})` : '(no coord)';\n console.log(`${s.id} [${s.source} ${coord}] ${s.urlNorm} — ${s.status}`);\n }\n}\n\nasync function handleDisable(argv: string[], apiUrl: string, token: string): Promise<void> {\n const id = requireId(argv);\n const reason = getArgValue(argv, '--reason');\n const res = await apiRequest<MutateResponse>(\n apiUrl,\n token,\n 'POST',\n `/org/augmentors/${id}/disable`,\n reason ? { reason } : undefined\n );\n if (!res.ok) fail(res.error ?? 'Unknown error');\n console.log(`Disabled augmentor ${id}.`);\n}\n\nasync function handleEnable(argv: string[], apiUrl: string, token: string): Promise<void> {\n const id = requireId(argv);\n const res = await apiRequest<MutateResponse>(apiUrl, token, 'POST', `/org/augmentors/${id}/enable`);\n if (!res.ok) fail(res.error ?? 'Unknown error');\n console.log(`Enabled augmentor ${id}.`);\n}\n\nexport async function runAugmentor(argv: string[], apiUrl: string, token: string): Promise<void> {\n const [action, ...rest] = argv;\n switch (action) {\n case undefined:\n case 'help':\n case '--help':\n printGuide();\n return;\n case 'list':\n await handleList(rest, apiUrl, token);\n return;\n case 'get':\n await handleGet(rest, apiUrl, token);\n return;\n case 'stats':\n await handleStats(rest, apiUrl, token);\n return;\n case 'signals':\n await handleSignals(rest, apiUrl, token);\n return;\n case 'disable':\n await handleDisable(rest, apiUrl, token);\n return;\n case 'enable':\n await handleEnable(rest, apiUrl, token);\n return;\n default:\n fail(`Unknown augmentor command: ${action}. Run \\`canary augmentor help\\`.`);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeA,OAAO,aAAa;AAqCpB,SAAS,KAAK,SAAwB;AACpC,UAAQ,MAAM,UAAU,OAAO,EAAE;AACjC,UAAQ,KAAK,CAAC;AAChB;AAEA,SAAS,mBAAmB,MAAwB;AAClD,QAAM,KAAK,kBAAkB,IAAI;AACjC,MAAI,CAAC,GAAI,MAAK,wCAAwC;AACtD,SAAO;AACT;AAEA,SAAS,UAAU,MAAwB;AACzC,QAAM,KAAK,YAAY,MAAM,MAAM;AACnC,MAAI,CAAC,GAAI,MAAK,gCAAgC;AAC9C,SAAO;AACT;AAEA,S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UAAQ,IAAI,qBAAqB,EAAE,GAAG;AACxC;AAEA,eAAsB,aAAa,MAAgB,QAAgB,OAA8B;AAC/F,QAAM,CAAC,QAAQ,GAAG,IAAI,IAAI;AAC1B,UAAQ,QAAQ;AAAA,IACd,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,iBAAW;AACX;AAAA,IACF,KAAK;AACH,YAAM,WAAW,MAAM,QAAQ,KAAK;AACpC;AAAA,IACF,KAAK;AACH,YAAM,UAAU,MAAM,QAAQ,KAAK;AACnC;AAAA,IACF,KAAK;AACH,YAAM,YAAY,MAAM,QAAQ,KAAK;AACrC;AAAA,IACF,KAAK;AACH,YAAM,cAAc,MAAM,QAAQ,KAAK;AACvC;AAAA,IACF,KAAK;AACH,YAAM,cAAc,MAAM,QAAQ,KAAK;AACvC;AAAA,IACF,KAAK;AACH,YAAM,aAAa,MAAM,QAAQ,KAAK;AACtC;AAAA,IACF;AACE,WAAK,8BAA8B,MAAM,kCAAkC;AAAA,EAC/E;AACF;","names":[]}
|
|
@@ -12,8 +12,8 @@ import {
|
|
|
12
12
|
resolveConfig,
|
|
13
13
|
resolveOptionalConfig,
|
|
14
14
|
saveAuth
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-IGHDIWZU.js";
|
|
16
|
+
import "./chunk-32P26BZT.js";
|
|
17
17
|
import "./chunk-VKVL7WBN.js";
|
|
18
18
|
export {
|
|
19
19
|
ENV_URLS,
|
|
@@ -29,4 +29,4 @@ export {
|
|
|
29
29
|
resolveOptionalConfig,
|
|
30
30
|
saveAuth
|
|
31
31
|
};
|
|
32
|
-
//# sourceMappingURL=auth-
|
|
32
|
+
//# sourceMappingURL=auth-DURHUZDW.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __cr } from "module"; const require = __cr(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
InlineAssertionSchema
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-IWKJQZJQ.js";
|
|
5
5
|
|
|
6
6
|
// ../canary-spec/src/parse.ts
|
|
7
7
|
import yaml from "yaml";
|
|
@@ -370,7 +370,13 @@ function parseCredentialRef(raw) {
|
|
|
370
370
|
if (trimmed.startsWith("seed-output ")) {
|
|
371
371
|
return { kind: "seedOutput", ref: trimmed.slice("seed-output ".length).trim() };
|
|
372
372
|
}
|
|
373
|
-
|
|
373
|
+
let explicitTemplatePrefix = null;
|
|
374
|
+
if (trimmed.startsWith("template ")) {
|
|
375
|
+
explicitTemplatePrefix = "template ";
|
|
376
|
+
} else if (trimmed.startsWith("persona ")) {
|
|
377
|
+
explicitTemplatePrefix = "persona ";
|
|
378
|
+
}
|
|
379
|
+
const role = explicitTemplatePrefix ? trimmed.slice(explicitTemplatePrefix.length).trim() : trimmed;
|
|
374
380
|
return { kind: "template", role };
|
|
375
381
|
}
|
|
376
382
|
function normalizeActor(raw) {
|
|
@@ -1902,7 +1908,7 @@ function diffWorkflow(spec, live) {
|
|
|
1902
1908
|
if (specApiOnly !== liveApiOnly) workflowFieldChanges.apiOnly = specApiOnly;
|
|
1903
1909
|
if (spec.tags !== void 0) {
|
|
1904
1910
|
const specSet = [...spec.tags].sort();
|
|
1905
|
-
const liveSet =
|
|
1911
|
+
const liveSet = (live.tags ?? []).map((t) => t.name).sort();
|
|
1906
1912
|
if (specSet.length !== liveSet.length || specSet.some((v, i) => v !== liveSet[i])) {
|
|
1907
1913
|
workflowFieldChanges.tags = spec.tags;
|
|
1908
1914
|
}
|
|
@@ -2620,4 +2626,4 @@ export {
|
|
|
2620
2626
|
writeWorkflowId,
|
|
2621
2627
|
writeNodeIds
|
|
2622
2628
|
};
|
|
2623
|
-
//# sourceMappingURL=chunk-
|
|
2629
|
+
//# sourceMappingURL=chunk-26U3DGUM.js.map
|