@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
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
extractPdfText,
|
|
4
4
|
extractPdfTextFromBuffer,
|
|
5
5
|
setPdfExtractLogger
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KRWRUU6R.js";
|
|
7
7
|
import "./chunk-VKVL7WBN.js";
|
|
8
8
|
export {
|
|
9
9
|
extractPdfText,
|
|
10
10
|
extractPdfTextFromBuffer,
|
|
11
11
|
setPdfExtractLogger
|
|
12
12
|
};
|
|
13
|
-
//# sourceMappingURL=pdf-extract-
|
|
13
|
+
//# sourceMappingURL=pdf-extract-YHE54XU4.js.map
|
|
@@ -0,0 +1,346 @@
|
|
|
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/product.ts
|
|
18
|
+
import process from "process";
|
|
19
|
+
var STAGES = [
|
|
20
|
+
"ideas",
|
|
21
|
+
"prioritized",
|
|
22
|
+
"in_development",
|
|
23
|
+
"dogfooding",
|
|
24
|
+
"beta",
|
|
25
|
+
"on_hold",
|
|
26
|
+
"ga",
|
|
27
|
+
"deprecated"
|
|
28
|
+
];
|
|
29
|
+
function formatItem(item) {
|
|
30
|
+
const priority = item.priority ? ` ${item.priority}` : "";
|
|
31
|
+
const flags = item.flagCount > 0 ? ` flags=${item.flagCount}${item.flagDriven ? "(driven)" : ""}` : "";
|
|
32
|
+
const customers = item.customers.length > 0 ? ` customers=${item.customers.length}` : "";
|
|
33
|
+
return ` ${item.id} ${item.title} (stage=${item.stage}${priority})${flags}${customers}`;
|
|
34
|
+
}
|
|
35
|
+
async function handleList(argv, apiUrl, token) {
|
|
36
|
+
const jsonOutput = hasFlag(argv, "--json");
|
|
37
|
+
const params = new URLSearchParams();
|
|
38
|
+
const search = getArgValue(argv, "--search");
|
|
39
|
+
if (search) params.set("search", search);
|
|
40
|
+
const priority = getArgValue(argv, "--priority");
|
|
41
|
+
if (priority) params.set("priority", priority);
|
|
42
|
+
if (hasFlag(argv, "--include-deprecated")) params.set("includeDeprecated", "true");
|
|
43
|
+
const query = params.toString();
|
|
44
|
+
const path = `/superadmin/product-board/items${query ? `?${query}` : ""}`;
|
|
45
|
+
const items = await fetchList(apiUrl, token, path, "items");
|
|
46
|
+
if (jsonOutput) {
|
|
47
|
+
console.log(JSON.stringify(items, null, 2));
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (items.length === 0) {
|
|
51
|
+
console.log("No product items found.");
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
for (const item of items) console.log(formatItem(item));
|
|
55
|
+
}
|
|
56
|
+
async function handleCreate(argv, apiUrl, token) {
|
|
57
|
+
const title = argv[0];
|
|
58
|
+
if (!title || title.startsWith("--")) {
|
|
59
|
+
console.error("Error: Missing title.");
|
|
60
|
+
console.error(
|
|
61
|
+
"Usage: canary product create <title> [--description <text>] [--stage <stage>] [--priority <p0-p3>]"
|
|
62
|
+
);
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
const description = getArgValue(argv, "--description");
|
|
66
|
+
const stage = getArgValue(argv, "--stage");
|
|
67
|
+
const priority = getArgValue(argv, "--priority");
|
|
68
|
+
const result = await apiRequest(
|
|
69
|
+
apiUrl,
|
|
70
|
+
token,
|
|
71
|
+
"POST",
|
|
72
|
+
"/superadmin/product-board/items",
|
|
73
|
+
{
|
|
74
|
+
title,
|
|
75
|
+
...description !== void 0 ? { description } : {},
|
|
76
|
+
...stage !== void 0 ? { stage } : {},
|
|
77
|
+
...priority !== void 0 ? { priority } : {}
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
if (!result.ok || !result.item) {
|
|
81
|
+
console.error(`Error: ${result.error ?? "Failed to create product item"}`);
|
|
82
|
+
process.exit(1);
|
|
83
|
+
}
|
|
84
|
+
console.log(`Created product item ${result.item.id}: ${result.item.title} (stage=${result.item.stage})`);
|
|
85
|
+
}
|
|
86
|
+
async function handleSet(argv, apiUrl, token) {
|
|
87
|
+
const id = argv[0];
|
|
88
|
+
if (!id || id.startsWith("--")) {
|
|
89
|
+
console.error("Error: Missing product item id.");
|
|
90
|
+
console.error("Usage: canary product set <id> [--title <text>] [--description <text>] [--priority <p0-p3|null>]");
|
|
91
|
+
process.exit(1);
|
|
92
|
+
}
|
|
93
|
+
const title = getArgValue(argv, "--title");
|
|
94
|
+
const description = getArgValue(argv, "--description");
|
|
95
|
+
const rawPriority = getArgValue(argv, "--priority");
|
|
96
|
+
if (title === void 0 && description === void 0 && rawPriority === void 0) {
|
|
97
|
+
console.error("Error: Provide at least one of --title, --description, --priority.");
|
|
98
|
+
process.exit(1);
|
|
99
|
+
}
|
|
100
|
+
const priority = rawPriority === void 0 ? void 0 : rawPriority === "null" ? null : rawPriority;
|
|
101
|
+
const result = await apiRequest(
|
|
102
|
+
apiUrl,
|
|
103
|
+
token,
|
|
104
|
+
"PATCH",
|
|
105
|
+
`/superadmin/product-board/items/${encodeURIComponent(id)}`,
|
|
106
|
+
{
|
|
107
|
+
...title !== void 0 ? { title } : {},
|
|
108
|
+
...description !== void 0 ? { description } : {},
|
|
109
|
+
...priority !== void 0 ? { priority } : {}
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
if (!result.ok || !result.item) {
|
|
113
|
+
console.error(`Error: ${result.error ?? "Failed to update product item"}`);
|
|
114
|
+
process.exit(1);
|
|
115
|
+
}
|
|
116
|
+
console.log(`Updated product item ${result.item.id}: ${result.item.title}`);
|
|
117
|
+
}
|
|
118
|
+
async function handleMove(argv, apiUrl, token) {
|
|
119
|
+
const id = argv[0];
|
|
120
|
+
const stage = getArgValue(argv, "--stage");
|
|
121
|
+
if (!id || id.startsWith("--")) {
|
|
122
|
+
console.error("Error: Missing product item id.");
|
|
123
|
+
console.error("Usage: canary product move <id> --stage <stage> [--before <id>] [--after <id>]");
|
|
124
|
+
process.exit(1);
|
|
125
|
+
}
|
|
126
|
+
if (!stage) {
|
|
127
|
+
console.error(`Error: --stage is required (one of: ${STAGES.join(", ")}).`);
|
|
128
|
+
process.exit(1);
|
|
129
|
+
}
|
|
130
|
+
const beforeItemId = getArgValue(argv, "--before") ?? null;
|
|
131
|
+
const afterItemId = getArgValue(argv, "--after") ?? null;
|
|
132
|
+
const result = await apiRequest(
|
|
133
|
+
apiUrl,
|
|
134
|
+
token,
|
|
135
|
+
"POST",
|
|
136
|
+
`/superadmin/product-board/items/${encodeURIComponent(id)}/move`,
|
|
137
|
+
{ stage, beforeItemId, afterItemId }
|
|
138
|
+
);
|
|
139
|
+
if (!result.ok || !result.item) {
|
|
140
|
+
console.error(`Error: ${result.error ?? "Failed to move product item"}`);
|
|
141
|
+
process.exit(1);
|
|
142
|
+
}
|
|
143
|
+
console.log(`Moved product item ${result.item.id} to stage=${result.item.stage}`);
|
|
144
|
+
}
|
|
145
|
+
async function handleDelete(argv, apiUrl, token) {
|
|
146
|
+
const id = argv[0];
|
|
147
|
+
if (!id || id.startsWith("--")) {
|
|
148
|
+
console.error("Error: Missing product item id.");
|
|
149
|
+
console.error("Usage: canary product delete <id>");
|
|
150
|
+
process.exit(1);
|
|
151
|
+
}
|
|
152
|
+
const result = await apiRequest(
|
|
153
|
+
apiUrl,
|
|
154
|
+
token,
|
|
155
|
+
"DELETE",
|
|
156
|
+
`/superadmin/product-board/items/${encodeURIComponent(id)}`
|
|
157
|
+
);
|
|
158
|
+
if (!result.ok) {
|
|
159
|
+
console.error(`Error: ${result.error}`);
|
|
160
|
+
process.exit(1);
|
|
161
|
+
}
|
|
162
|
+
console.log(`Deleted product item ${id}`);
|
|
163
|
+
}
|
|
164
|
+
async function handleCustomer(argv, apiUrl, token) {
|
|
165
|
+
const [action, id, ...rest] = argv;
|
|
166
|
+
if (action === "add") {
|
|
167
|
+
if (!id) {
|
|
168
|
+
console.error("Usage: canary product customer add <id> (--account-card <id> | --org <orgId>) [--name <text>]");
|
|
169
|
+
process.exit(1);
|
|
170
|
+
}
|
|
171
|
+
const accountCardId = getArgValue(rest, "--account-card");
|
|
172
|
+
const orgId = getArgValue(rest, "--org");
|
|
173
|
+
const name = getArgValue(rest, "--name");
|
|
174
|
+
if (!accountCardId && !orgId && !name) {
|
|
175
|
+
console.error("Error: Provide --account-card, --org, or --name.");
|
|
176
|
+
process.exit(1);
|
|
177
|
+
}
|
|
178
|
+
const result = await apiRequest(
|
|
179
|
+
apiUrl,
|
|
180
|
+
token,
|
|
181
|
+
"POST",
|
|
182
|
+
`/superadmin/product-board/items/${encodeURIComponent(id)}/customers`,
|
|
183
|
+
{
|
|
184
|
+
...accountCardId !== void 0 ? { accountCardId } : {},
|
|
185
|
+
...orgId !== void 0 ? { orgId } : {},
|
|
186
|
+
...name !== void 0 ? { name } : {}
|
|
187
|
+
}
|
|
188
|
+
);
|
|
189
|
+
if (!result.ok || !result.customer) {
|
|
190
|
+
console.error(`Error: ${result.error ?? "Failed to add customer"}`);
|
|
191
|
+
process.exit(1);
|
|
192
|
+
}
|
|
193
|
+
console.log(`Linked customer ${result.customer.name} to product item ${id}`);
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
if (action === "remove") {
|
|
197
|
+
const customerId = rest[0] ?? getArgValue(rest, "--customer");
|
|
198
|
+
if (!id || !customerId) {
|
|
199
|
+
console.error("Usage: canary product customer remove <id> <customerId>");
|
|
200
|
+
process.exit(1);
|
|
201
|
+
}
|
|
202
|
+
const result = await apiRequest(
|
|
203
|
+
apiUrl,
|
|
204
|
+
token,
|
|
205
|
+
"DELETE",
|
|
206
|
+
`/superadmin/product-board/items/${encodeURIComponent(id)}/customers/${encodeURIComponent(customerId)}`
|
|
207
|
+
);
|
|
208
|
+
if (!result.ok) {
|
|
209
|
+
console.error(`Error: ${result.error}`);
|
|
210
|
+
process.exit(1);
|
|
211
|
+
}
|
|
212
|
+
console.log(`Removed customer ${customerId} from product item ${id}`);
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
console.error("Usage: canary product customer <add|remove> ...");
|
|
216
|
+
process.exit(1);
|
|
217
|
+
}
|
|
218
|
+
async function handleLinkFlag(argv, apiUrl, token) {
|
|
219
|
+
const cardId = argv[0] && !argv[0].startsWith("--") ? argv[0] : void 0;
|
|
220
|
+
const flagName = getArgValue(argv, "--flag");
|
|
221
|
+
const clear = hasFlag(argv, "--clear");
|
|
222
|
+
if (!flagName) {
|
|
223
|
+
console.error("Error: --flag <name> is required.");
|
|
224
|
+
console.error("Usage: canary product link-flag <cardId> --flag <name> | canary product link-flag --flag <name> --clear");
|
|
225
|
+
process.exit(1);
|
|
226
|
+
}
|
|
227
|
+
if (clear === Boolean(cardId)) {
|
|
228
|
+
console.error("Error: Provide either a <cardId> to link or --clear to unlink (not both/neither).");
|
|
229
|
+
process.exit(1);
|
|
230
|
+
}
|
|
231
|
+
const result = await apiRequest(
|
|
232
|
+
apiUrl,
|
|
233
|
+
token,
|
|
234
|
+
"POST",
|
|
235
|
+
`/superadmin/feature-flags/${encodeURIComponent(flagName)}/product`,
|
|
236
|
+
{ productCardId: clear ? null : cardId }
|
|
237
|
+
);
|
|
238
|
+
if (!result.ok) {
|
|
239
|
+
console.error(`Error: ${result.error}`);
|
|
240
|
+
process.exit(1);
|
|
241
|
+
}
|
|
242
|
+
console.log(
|
|
243
|
+
clear ? `Cleared product link for flag ${flagName}` : `Linked flag ${flagName} to product ${result.flag?.productTitle ?? cardId}`
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
async function handleFlags(argv, apiUrl, token) {
|
|
247
|
+
const cardId = argv[0];
|
|
248
|
+
const jsonOutput = hasFlag(argv, "--json");
|
|
249
|
+
if (!cardId || cardId.startsWith("--")) {
|
|
250
|
+
console.error("Usage: canary product flags <cardId>");
|
|
251
|
+
process.exit(1);
|
|
252
|
+
}
|
|
253
|
+
const flags = await fetchList(
|
|
254
|
+
apiUrl,
|
|
255
|
+
token,
|
|
256
|
+
`/superadmin/feature-flags/by-product-card/${encodeURIComponent(cardId)}`,
|
|
257
|
+
"flags"
|
|
258
|
+
);
|
|
259
|
+
if (jsonOutput) {
|
|
260
|
+
console.log(JSON.stringify(flags, null, 2));
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
if (flags.length === 0) {
|
|
264
|
+
console.log("No feature flags linked to this product card.");
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
for (const flag of flags) {
|
|
268
|
+
console.log(` ${flag.name} (lifecycle=${flag.lifecycleStage}, orgGates=${flag.activeOrgGateCount})`);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
function printProductHelp() {
|
|
272
|
+
console.log(
|
|
273
|
+
[
|
|
274
|
+
"Usage: canary product <sub-command> [options]",
|
|
275
|
+
"",
|
|
276
|
+
"Manage the Product board (cards.boardType=product_item) for the org you are logged into.",
|
|
277
|
+
"",
|
|
278
|
+
"Sub-commands:",
|
|
279
|
+
" list [--search <text>] [--priority p0,p1] [--include-deprecated] [--json]",
|
|
280
|
+
" List product items",
|
|
281
|
+
" create <title> [--description <text>] [--stage <stage>] [--priority <p0-p3>]",
|
|
282
|
+
" Create a product item",
|
|
283
|
+
" set <id> [--title <text>] [--description <text>] [--priority <p0-p3|null>]",
|
|
284
|
+
" Update a product item's fields",
|
|
285
|
+
" move <id> --stage <stage> [--before <id>] [--after <id>]",
|
|
286
|
+
" Move a card to another column (blocked when flag-driven)",
|
|
287
|
+
" delete <id> Delete a product item",
|
|
288
|
+
" customer add <id> (--account-card <id> | --org <orgId>) [--name <text>]",
|
|
289
|
+
" customer remove <id> <customerId> Link/unlink a customer (account card or org)",
|
|
290
|
+
" link-flag <cardId> --flag <name> Link a feature flag to this product card",
|
|
291
|
+
" link-flag --flag <name> --clear Clear a flag's product link",
|
|
292
|
+
" flags <cardId> [--json] List feature flags linked to a product card",
|
|
293
|
+
"",
|
|
294
|
+
`Stages: ${STAGES.join(", ")}`,
|
|
295
|
+
"Priorities: p0, p1, p2, p3",
|
|
296
|
+
"",
|
|
297
|
+
"Options:",
|
|
298
|
+
" --env <env> Target environment (prod, dev, local)",
|
|
299
|
+
" --json Output as JSON (list/flags only)",
|
|
300
|
+
" --api-url <url> API URL override (takes precedence over --env)",
|
|
301
|
+
" --token <key> API token override"
|
|
302
|
+
].join("\n")
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
async function runProduct(argv) {
|
|
306
|
+
const [subCommand, ...rest] = argv;
|
|
307
|
+
if (!subCommand || subCommand === "help" || hasFlag(argv, "--help", "-h")) {
|
|
308
|
+
printProductHelp();
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
const { apiUrl, token } = await resolveConfig(argv);
|
|
312
|
+
switch (subCommand) {
|
|
313
|
+
case "list":
|
|
314
|
+
await handleList(rest, apiUrl, token);
|
|
315
|
+
break;
|
|
316
|
+
case "create":
|
|
317
|
+
await handleCreate(rest, apiUrl, token);
|
|
318
|
+
break;
|
|
319
|
+
case "set":
|
|
320
|
+
await handleSet(rest, apiUrl, token);
|
|
321
|
+
break;
|
|
322
|
+
case "move":
|
|
323
|
+
await handleMove(rest, apiUrl, token);
|
|
324
|
+
break;
|
|
325
|
+
case "delete":
|
|
326
|
+
await handleDelete(rest, apiUrl, token);
|
|
327
|
+
break;
|
|
328
|
+
case "customer":
|
|
329
|
+
await handleCustomer(rest, apiUrl, token);
|
|
330
|
+
break;
|
|
331
|
+
case "link-flag":
|
|
332
|
+
await handleLinkFlag(rest, apiUrl, token);
|
|
333
|
+
break;
|
|
334
|
+
case "flags":
|
|
335
|
+
await handleFlags(rest, apiUrl, token);
|
|
336
|
+
break;
|
|
337
|
+
default:
|
|
338
|
+
console.error(`Unknown sub-command: ${subCommand}`);
|
|
339
|
+
printProductHelp();
|
|
340
|
+
process.exit(1);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
export {
|
|
344
|
+
runProduct
|
|
345
|
+
};
|
|
346
|
+
//# sourceMappingURL=product-RSZV5HMB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/product.ts"],"sourcesContent":["/**\n * CLI Product Board Management\n *\n * Superadmin CRUD for the Product board (cards.boardType='product_item'),\n * scoped to the org the CLI user is logged into. Backed by\n * `/superadmin/product-board/*`. Flag↔card linking re-surfaces the existing\n * `/superadmin/feature-flags/:name/product` endpoint for convenience.\n */\n\nimport process from 'node:process';\nimport { resolveConfig, getArgValue, hasFlag } from './auth.js';\nimport { apiRequest, fetchList } from './cli-helpers.js';\n\ntype ProductItemCustomer = {\n id: string;\n name: string;\n orgId: string | null;\n accountCardId: string | null;\n};\n\ntype ProductItem = {\n id: string;\n title: string;\n description: string;\n stage: string;\n priority: string | null;\n sortOrder: number;\n customers: ProductItemCustomer[];\n flagCount: number;\n flagDriven: boolean;\n};\n\ntype ProductApiResponse = {\n ok: boolean;\n error?: string;\n item?: ProductItem;\n customer?: ProductItemCustomer;\n};\n\ntype ProductCardFlag = {\n id: string;\n name: string;\n lifecycleStage: string;\n activeOrgGateCount: number;\n};\n\nconst STAGES = [\n 'ideas',\n 'prioritized',\n 'in_development',\n 'dogfooding',\n 'beta',\n 'on_hold',\n 'ga',\n 'deprecated',\n];\n\nfunction formatItem(item: ProductItem): string {\n const priority = item.priority ? ` ${item.priority}` : '';\n const flags = item.flagCount > 0 ? ` flags=${item.flagCount}${item.flagDriven ? '(driven)' : ''}` : '';\n const customers = item.customers.length > 0 ? ` customers=${item.customers.length}` : '';\n return ` ${item.id} ${item.title} (stage=${item.stage}${priority})${flags}${customers}`;\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 priority = getArgValue(argv, '--priority');\n if (priority) params.set('priority', priority);\n if (hasFlag(argv, '--include-deprecated')) params.set('includeDeprecated', 'true');\n const query = params.toString();\n const path = `/superadmin/product-board/items${query ? `?${query}` : ''}`;\n const items = await fetchList<ProductItem>(apiUrl, token, path, 'items');\n\n if (jsonOutput) {\n console.log(JSON.stringify(items, null, 2));\n return;\n }\n if (items.length === 0) {\n console.log('No product items found.');\n return;\n }\n for (const item of items) console.log(formatItem(item));\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 title.');\n console.error(\n 'Usage: canary product create <title> [--description <text>] [--stage <stage>] [--priority <p0-p3>]'\n );\n process.exit(1);\n }\n\n const description = getArgValue(argv, '--description');\n const stage = getArgValue(argv, '--stage');\n const priority = getArgValue(argv, '--priority');\n\n const result = await apiRequest<ProductApiResponse>(\n apiUrl,\n token,\n 'POST',\n '/superadmin/product-board/items',\n {\n title,\n ...(description !== undefined ? { description } : {}),\n ...(stage !== undefined ? { stage } : {}),\n ...(priority !== undefined ? { priority } : {}),\n }\n );\n\n if (!result.ok || !result.item) {\n console.error(`Error: ${result.error ?? 'Failed to create product item'}`);\n process.exit(1);\n }\n console.log(`Created product item ${result.item.id}: ${result.item.title} (stage=${result.item.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 product item id.');\n console.error('Usage: canary product set <id> [--title <text>] [--description <text>] [--priority <p0-p3|null>]');\n process.exit(1);\n }\n\n const title = getArgValue(argv, '--title');\n const description = getArgValue(argv, '--description');\n const rawPriority = getArgValue(argv, '--priority');\n\n if (title === undefined && description === undefined && rawPriority === undefined) {\n console.error('Error: Provide at least one of --title, --description, --priority.');\n process.exit(1);\n }\n\n // `--priority null` clears the priority; otherwise pass the value through.\n const priority = rawPriority === undefined ? undefined : rawPriority === 'null' ? null : rawPriority;\n\n const result = await apiRequest<ProductApiResponse>(\n apiUrl,\n token,\n 'PATCH',\n `/superadmin/product-board/items/${encodeURIComponent(id)}`,\n {\n ...(title !== undefined ? { title } : {}),\n ...(description !== undefined ? { description } : {}),\n ...(priority !== undefined ? { priority } : {}),\n }\n );\n\n if (!result.ok || !result.item) {\n console.error(`Error: ${result.error ?? 'Failed to update product item'}`);\n process.exit(1);\n }\n console.log(`Updated product item ${result.item.id}: ${result.item.title}`);\n}\n\nasync function handleMove(argv: string[], apiUrl: string, token: string): Promise<void> {\n const id = argv[0];\n const stage = getArgValue(argv, '--stage');\n if (!id || id.startsWith('--')) {\n console.error('Error: Missing product item id.');\n console.error('Usage: canary product move <id> --stage <stage> [--before <id>] [--after <id>]');\n process.exit(1);\n }\n if (!stage) {\n console.error(`Error: --stage is required (one of: ${STAGES.join(', ')}).`);\n process.exit(1);\n }\n\n const beforeItemId = getArgValue(argv, '--before') ?? null;\n const afterItemId = getArgValue(argv, '--after') ?? null;\n\n const result = await apiRequest<ProductApiResponse>(\n apiUrl,\n token,\n 'POST',\n `/superadmin/product-board/items/${encodeURIComponent(id)}/move`,\n { stage, beforeItemId, afterItemId }\n );\n\n if (!result.ok || !result.item) {\n console.error(`Error: ${result.error ?? 'Failed to move product item'}`);\n process.exit(1);\n }\n console.log(`Moved product item ${result.item.id} to stage=${result.item.stage}`);\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 product item id.');\n console.error('Usage: canary product delete <id>');\n process.exit(1);\n }\n\n const result = await apiRequest<ProductApiResponse>(\n apiUrl,\n token,\n 'DELETE',\n `/superadmin/product-board/items/${encodeURIComponent(id)}`\n );\n\n if (!result.ok) {\n console.error(`Error: ${result.error}`);\n process.exit(1);\n }\n console.log(`Deleted product item ${id}`);\n}\n\nasync function handleCustomer(argv: string[], apiUrl: string, token: string): Promise<void> {\n const [action, id, ...rest] = argv;\n if (action === 'add') {\n if (!id) {\n console.error('Usage: canary product customer add <id> (--account-card <id> | --org <orgId>) [--name <text>]');\n process.exit(1);\n }\n const accountCardId = getArgValue(rest, '--account-card');\n const orgId = getArgValue(rest, '--org');\n const name = getArgValue(rest, '--name');\n if (!accountCardId && !orgId && !name) {\n console.error('Error: Provide --account-card, --org, or --name.');\n process.exit(1);\n }\n const result = await apiRequest<ProductApiResponse>(\n apiUrl,\n token,\n 'POST',\n `/superadmin/product-board/items/${encodeURIComponent(id)}/customers`,\n {\n ...(accountCardId !== undefined ? { accountCardId } : {}),\n ...(orgId !== undefined ? { orgId } : {}),\n ...(name !== undefined ? { name } : {}),\n }\n );\n if (!result.ok || !result.customer) {\n console.error(`Error: ${result.error ?? 'Failed to add customer'}`);\n process.exit(1);\n }\n console.log(`Linked customer ${result.customer.name} to product item ${id}`);\n return;\n }\n\n if (action === 'remove') {\n const customerId = rest[0] ?? getArgValue(rest, '--customer');\n if (!id || !customerId) {\n console.error('Usage: canary product customer remove <id> <customerId>');\n process.exit(1);\n }\n const result = await apiRequest<ProductApiResponse>(\n apiUrl,\n token,\n 'DELETE',\n `/superadmin/product-board/items/${encodeURIComponent(id)}/customers/${encodeURIComponent(customerId)}`\n );\n if (!result.ok) {\n console.error(`Error: ${result.error}`);\n process.exit(1);\n }\n console.log(`Removed customer ${customerId} from product item ${id}`);\n return;\n }\n\n console.error('Usage: canary product customer <add|remove> ...');\n process.exit(1);\n}\n\nasync function handleLinkFlag(argv: string[], apiUrl: string, token: string): Promise<void> {\n const cardId = argv[0] && !argv[0].startsWith('--') ? argv[0] : undefined;\n const flagName = getArgValue(argv, '--flag');\n const clear = hasFlag(argv, '--clear');\n\n if (!flagName) {\n console.error('Error: --flag <name> is required.');\n console.error('Usage: canary product link-flag <cardId> --flag <name> | canary product link-flag --flag <name> --clear');\n process.exit(1);\n }\n if (clear === Boolean(cardId)) {\n console.error('Error: Provide either a <cardId> to link or --clear to unlink (not both/neither).');\n process.exit(1);\n }\n\n const result = await apiRequest<{ ok: boolean; error?: string; flag?: { productTitle?: string | null } }>(\n apiUrl,\n token,\n 'POST',\n `/superadmin/feature-flags/${encodeURIComponent(flagName)}/product`,\n { productCardId: clear ? null : cardId }\n );\n\n if (!result.ok) {\n console.error(`Error: ${result.error}`);\n process.exit(1);\n }\n console.log(\n clear\n ? `Cleared product link for flag ${flagName}`\n : `Linked flag ${flagName} to product ${result.flag?.productTitle ?? cardId}`\n );\n}\n\nasync function handleFlags(argv: string[], apiUrl: string, token: string): Promise<void> {\n const cardId = argv[0];\n const jsonOutput = hasFlag(argv, '--json');\n if (!cardId || cardId.startsWith('--')) {\n console.error('Usage: canary product flags <cardId>');\n process.exit(1);\n }\n const flags = await fetchList<ProductCardFlag>(\n apiUrl,\n token,\n `/superadmin/feature-flags/by-product-card/${encodeURIComponent(cardId)}`,\n 'flags'\n );\n if (jsonOutput) {\n console.log(JSON.stringify(flags, null, 2));\n return;\n }\n if (flags.length === 0) {\n console.log('No feature flags linked to this product card.');\n return;\n }\n for (const flag of flags) {\n console.log(` ${flag.name} (lifecycle=${flag.lifecycleStage}, orgGates=${flag.activeOrgGateCount})`);\n }\n}\n\nfunction printProductHelp(): void {\n console.log(\n [\n 'Usage: canary product <sub-command> [options]',\n '',\n 'Manage the Product board (cards.boardType=product_item) for the org you are logged into.',\n '',\n 'Sub-commands:',\n ' list [--search <text>] [--priority p0,p1] [--include-deprecated] [--json]',\n ' List product items',\n ' create <title> [--description <text>] [--stage <stage>] [--priority <p0-p3>]',\n ' Create a product item',\n ' set <id> [--title <text>] [--description <text>] [--priority <p0-p3|null>]',\n ' Update a product item\\'s fields',\n ' move <id> --stage <stage> [--before <id>] [--after <id>]',\n ' Move a card to another column (blocked when flag-driven)',\n ' delete <id> Delete a product item',\n ' customer add <id> (--account-card <id> | --org <orgId>) [--name <text>]',\n ' customer remove <id> <customerId> Link/unlink a customer (account card or org)',\n ' link-flag <cardId> --flag <name> Link a feature flag to this product card',\n ' link-flag --flag <name> --clear Clear a flag\\'s product link',\n ' flags <cardId> [--json] List feature flags linked to a product card',\n '',\n `Stages: ${STAGES.join(', ')}`,\n 'Priorities: p0, p1, p2, p3',\n '',\n 'Options:',\n ' --env <env> Target environment (prod, dev, local)',\n ' --json Output as JSON (list/flags 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 runProduct(argv: string[]): Promise<void> {\n const [subCommand, ...rest] = argv;\n\n if (!subCommand || subCommand === 'help' || hasFlag(argv, '--help', '-h')) {\n printProductHelp();\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 'move':\n await handleMove(rest, apiUrl, token);\n break;\n case 'delete':\n await handleDelete(rest, apiUrl, token);\n break;\n case 'customer':\n await handleCustomer(rest, apiUrl, token);\n break;\n case 'link-flag':\n await handleLinkFlag(rest, apiUrl, token);\n break;\n case 'flags':\n await handleFlags(rest, apiUrl, token);\n break;\n default:\n console.error(`Unknown sub-command: ${subCommand}`);\n printProductHelp();\n process.exit(1);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AASA,OAAO,aAAa;AAqCpB,IAAM,SAAS;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,SAAS,WAAW,MAA2B;AAC7C,QAAM,WAAW,KAAK,WAAW,IAAI,KAAK,QAAQ,KAAK;AACvD,QAAM,QAAQ,KAAK,YAAY,IAAI,UAAU,KAAK,SAAS,GAAG,KAAK,aAAa,aAAa,EAAE,KAAK;AACpG,QAAM,YAAY,KAAK,UAAU,SAAS,IAAI,cAAc,KAAK,UAAU,MAAM,KAAK;AACtF,SAAO,KAAK,KAAK,EAAE,KAAK,KAAK,KAAK,YAAY,KAAK,KAAK,GAAG,QAAQ,IAAI,KAAK,GAAG,SAAS;AAC1F;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,MA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AAQ,KAAK;AACtC;AAAA,IACF,KAAK;AACH,YAAM,UAAU,MAAM,QAAQ,KAAK;AACnC;AAAA,IACF,KAAK;AACH,YAAM,WAAW,MAAM,QAAQ,KAAK;AACpC;AAAA,IACF,KAAK;AACH,YAAM,aAAa,MAAM,QAAQ,KAAK;AACtC;AAAA,IACF,KAAK;AACH,YAAM,eAAe,MAAM,QAAQ,KAAK;AACxC;AAAA,IACF,KAAK;AACH,YAAM,eAAe,MAAM,QAAQ,KAAK;AACxC;AAAA,IACF,KAAK;AACH,YAAM,YAAY,MAAM,QAAQ,KAAK;AACrC;AAAA,IACF;AACE,cAAQ,MAAM,wBAAwB,UAAU,EAAE;AAClD,uBAAiB;AACjB,cAAQ,KAAK,CAAC;AAAA,EAClB;AACF;","names":[]}
|
|
@@ -3,16 +3,16 @@ import {
|
|
|
3
3
|
apiRequest,
|
|
4
4
|
fetchProperties,
|
|
5
5
|
getApplicationArg
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-CFJXYPTF.js";
|
|
7
7
|
import "./chunk-3CZU7XCS.js";
|
|
8
8
|
import {
|
|
9
9
|
getArgValue,
|
|
10
10
|
hasFlag,
|
|
11
11
|
resolveConfig
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-IGHDIWZU.js";
|
|
13
|
+
import "./chunk-32P26BZT.js";
|
|
14
14
|
import "./chunk-JWHYXEA2.js";
|
|
15
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-IWKJQZJQ.js";
|
|
16
16
|
import "./chunk-VKVL7WBN.js";
|
|
17
17
|
|
|
18
18
|
// src/property.ts
|
|
@@ -770,4 +770,4 @@ async function runProperty(argv) {
|
|
|
770
770
|
export {
|
|
771
771
|
runProperty
|
|
772
772
|
};
|
|
773
|
-
//# sourceMappingURL=property-
|
|
773
|
+
//# sourceMappingURL=property-YP4GHQAR.js.map
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
} from "./chunk-3CZU7XCS.js";
|
|
5
5
|
import {
|
|
6
6
|
resolveConfig
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-IGHDIWZU.js";
|
|
8
|
+
import "./chunk-32P26BZT.js";
|
|
9
9
|
import "./chunk-VKVL7WBN.js";
|
|
10
10
|
|
|
11
11
|
// src/psql.ts
|
|
@@ -113,4 +113,4 @@ Time: ${json.durationMs}ms`);
|
|
|
113
113
|
export {
|
|
114
114
|
runPsql
|
|
115
115
|
};
|
|
116
|
-
//# sourceMappingURL=psql-
|
|
116
|
+
//# sourceMappingURL=psql-XGLBI6T7.js.map
|
|
@@ -7,18 +7,18 @@ import {
|
|
|
7
7
|
apiRequest,
|
|
8
8
|
downloadStorageState,
|
|
9
9
|
selectCredential
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-CFJXYPTF.js";
|
|
11
11
|
import "./chunk-3CZU7XCS.js";
|
|
12
12
|
import {
|
|
13
13
|
getArgValue,
|
|
14
14
|
hasFlag,
|
|
15
15
|
resolveConfig
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-IGHDIWZU.js";
|
|
17
|
+
import "./chunk-32P26BZT.js";
|
|
18
18
|
import {
|
|
19
19
|
getCanaryTmpDir
|
|
20
20
|
} from "./chunk-JWHYXEA2.js";
|
|
21
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-IWKJQZJQ.js";
|
|
22
22
|
import "./chunk-VKVL7WBN.js";
|
|
23
23
|
|
|
24
24
|
// src/record.ts
|
|
@@ -86,7 +86,7 @@ async function runRecord(argv) {
|
|
|
86
86
|
);
|
|
87
87
|
}
|
|
88
88
|
console.log("Launching browser...");
|
|
89
|
-
const { PlaywrightClient, consoleLogger, captureElementAtPoint } = await import("./src-
|
|
89
|
+
const { PlaywrightClient, consoleLogger, captureElementAtPoint } = await import("./src-CV57ZD6I.js");
|
|
90
90
|
const client = new PlaywrightClient({ logger: consoleLogger });
|
|
91
91
|
await client.connect({
|
|
92
92
|
browserMode: "headed",
|
|
@@ -229,4 +229,4 @@ Output directory: ${outDir}`);
|
|
|
229
229
|
export {
|
|
230
230
|
runRecord
|
|
231
231
|
};
|
|
232
|
-
//# sourceMappingURL=record-
|
|
232
|
+
//# sourceMappingURL=record-KWKHP2ZY.js.map
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
} from "./chunk-3CZU7XCS.js";
|
|
5
5
|
import {
|
|
6
6
|
resolveConfig
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-IGHDIWZU.js";
|
|
8
|
+
import "./chunk-32P26BZT.js";
|
|
9
9
|
import "./chunk-VKVL7WBN.js";
|
|
10
10
|
|
|
11
11
|
// src/redis.ts
|
|
@@ -114,4 +114,4 @@ Time: ${json_response.durationMs}ms`);
|
|
|
114
114
|
export {
|
|
115
115
|
runRedis
|
|
116
116
|
};
|
|
117
|
-
//# sourceMappingURL=redis-
|
|
117
|
+
//# sourceMappingURL=redis-VJGCUJPV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/redis.ts"],"sourcesContent":["/**\n * CLI Redis Passthrough\n *\n * Allows superadmins to execute read-only Redis commands against the production cache.\n */\n\nimport process from \"node:process\";\nimport { resolveConfig } from \"./auth.js\";\nimport { fetchOrExit } from \"./api-fetch.js\";\n\nconst MAX_COMMAND_SIZE = 10_000; // 10KB - reasonable for interactive use\n\ntype RedisResponse = {\n ok: boolean;\n data?: unknown;\n durationMs?: number;\n error?: string;\n code?: \"DISABLED\" | \"BLOCKED\";\n};\n\nfunction hasFlag(argv: string[], ...flags: string[]): boolean {\n return flags.some((flag) => argv.includes(flag));\n}\n\n/**\n * Formats Redis response for display.\n */\nfunction formatOutput(data: unknown): string {\n if (data === null) {\n return \"(nil)\";\n }\n\n if (typeof data === \"string\") {\n return data;\n }\n\n if (typeof data === \"number\") {\n return `(integer) ${data}`;\n }\n\n if (Array.isArray(data)) {\n if (data.length === 0) {\n return \"(empty array)\";\n }\n return data\n .map((item, index) => `${index + 1}) ${formatOutput(item)}`)\n .join(\"\\n\");\n }\n\n if (typeof data === \"object\") {\n return JSON.stringify(data, null, 2);\n }\n\n return String(data);\n}\n\nexport async function runRedis(argv: string[]): Promise<void> {\n const { apiUrl, token } = await resolveConfig(argv);\n\n const jsonOutput = hasFlag(argv, \"--json\");\n\n // Get command: remaining args after filtering flags\n const flagsWithValues = [\"--api-url\", \"--token\", \"--env\"];\n const commandParts: string[] = [];\n for (let i = 0; i < argv.length; i++) {\n if (flagsWithValues.includes(argv[i])) {\n i++; // Skip flag value\n continue;\n }\n if (argv[i].startsWith(\"--\")) continue;\n commandParts.push(argv[i]);\n }\n const command = commandParts.join(\" \");\n\n if (!command) {\n console.error(\"Error: No command provided.\");\n console.error(\"\");\n console.error(\"Usage: canary redis <command> [--json]\");\n console.error(' canary redis KEYS \"job:*\"');\n console.error(\"\");\n console.error(\"Examples:\");\n console.error(\" canary redis PING\");\n console.error(\" canary redis INFO\");\n console.error(' canary redis KEYS \"job:*\"');\n console.error(' canary redis HGETALL \"job:123:status\"');\n console.error(' canary redis GET \"some:key\" --json');\n process.exit(1);\n }\n\n if (command.length > MAX_COMMAND_SIZE) {\n console.error(`Error: Command too large (${command.length} chars, max ${MAX_COMMAND_SIZE})`);\n process.exit(1);\n }\n\n try {\n const res = await fetchOrExit(`${apiUrl}/superadmin/redis`, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${token}`,\n \"Content-Type\": \"application/json\",\n },\n token,\n body: JSON.stringify({ command }),\n });\n\n // Handle HTTP errors before parsing JSON\n if (!res.ok) {\n const text = await res.text();\n\n if (res.status === 404) {\n console.error(\"Error: Endpoint not found. The redis feature may not be deployed to this environment.\");\n process.exit(1);\n }\n\n // Try to parse error as JSON, fallback to raw text\n try {\n const errorJson = JSON.parse(text) as { error?: string };\n console.error(`Error: ${errorJson.error ?? text}`);\n } catch {\n console.error(`Error (${res.status}): ${text || res.statusText}`);\n }\n process.exit(1);\n }\n\n const json_response = (await res.json()) as RedisResponse;\n\n if (!json_response.ok) {\n console.error(`Error: ${json_response.error}`);\n if (json_response.code === \"BLOCKED\") {\n console.error(\"The Redis debugging feature has been disabled due to this blocked command.\");\n }\n process.exit(1);\n }\n\n if (jsonOutput) {\n console.log(JSON.stringify(json_response.data, null, 2));\n } else {\n console.log(formatOutput(json_response.data));\n console.log(`\\nTime: ${json_response.durationMs}ms`);\n }\n } catch (err) {\n console.error(`Failed to execute command: ${err}`);\n process.exit(1);\n }\n}\n"],"mappings":";;;;;;;;;;;AAMA,OAAO,aAAa;AAIpB,IAAM,mBAAmB;AAUzB,SAAS,QAAQ,SAAmB,OAA0B;AAC5D,SAAO,MAAM,KAAK,CAAC,SAAS,KAAK,SAAS,IAAI,CAAC;AACjD;AAKA,SAAS,aAAa,MAAuB;AAC3C,MAAI,SAAS,MAAM;AACjB,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,SAAS,UAAU;AAC5B,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,SAAS,UAAU;AAC5B,WAAO,aAAa,IAAI;AAAA,EAC1B;AAEA,MAAI,MAAM,QAAQ,IAAI,GAAG;AACvB,QAAI,KAAK,WAAW,GAAG;AACrB,aAAO;AAAA,IACT;AACA,WAAO,KACJ,IAAI,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC,KAAK,aAAa,IAAI,CAAC,EAAE,EAC1D,KAAK,IAAI;AAAA,EACd;AAEA,MAAI,OAAO,SAAS,UAAU;AAC5B,WAAO,KAAK,UAAU,MAAM,MAAM,CAAC;AAAA,EACrC;AAEA,SAAO,OAAO,IAAI;AACpB;AAEA,eAAsB,SAAS,MAA+B;AAC5D,QAAM,EAAE,QAAQ,MAAM,IAAI,MAAM,cAAc,IAAI;AAElD,QAAM,aAAa,QAAQ,MAAM,QAAQ;AAGzC,QAAM,kBAAkB,CAAC,aAAa,WAAW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ACjC,gBAAQ,MAAM,UAAU,UAAU,SAAS,IAAI,EAAE;AAAA,MACnD,QAAQ;AACN,gBAAQ,MAAM,UAAU,IAAI,MAAM,MAAM,QAAQ,IAAI,UAAU,EAAE;AAAA,MAClE;AACA,cAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,UAAM,gBAAiB,MAAM,IAAI,KAAK;AAEtC,QAAI,CAAC,cAAc,IAAI;AACrB,cAAQ,MAAM,UAAU,cAAc,KAAK,EAAE;AAC7C,UAAI,cAAc,SAAS,WAAW;AACpC,gBAAQ,MAAM,4EAA4E;AAAA,MAC5F;AACA,cAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,QAAI,YAAY;AACd,cAAQ,IAAI,KAAK,UAAU,cAAc,MAAM,MAAM,CAAC,CAAC;AAAA,IACzD,OAAO;AACL,cAAQ,IAAI,aAAa,cAAc,IAAI,CAAC;AAC5C,cAAQ,IAAI;AAAA,QAAW,cAAc,UAAU,IAAI;AAAA,IACrD;AAAA,EACF,SAAS,KAAK;AACZ,YAAQ,MAAM,8BAA8B,GAAG,EAAE;AACjD,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;","names":[]}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { createRequire as __cr } from "module"; const require = __cr(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
getApplicationIdArg
|
|
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/release.ts
|
|
@@ -352,4 +352,4 @@ async function runRelease(argv) {
|
|
|
352
352
|
export {
|
|
353
353
|
runRelease
|
|
354
354
|
};
|
|
355
|
-
//# sourceMappingURL=release-
|
|
355
|
+
//# sourceMappingURL=release-NDRHPW6V.js.map
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
apiRequest,
|
|
8
8
|
selectProperty
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-CFJXYPTF.js";
|
|
10
10
|
import {
|
|
11
11
|
apiFetch,
|
|
12
12
|
exitOnFailure,
|
|
@@ -16,14 +16,14 @@ import {
|
|
|
16
16
|
getArgValue,
|
|
17
17
|
hasFlag,
|
|
18
18
|
resolveConfig
|
|
19
|
-
} from "./chunk-
|
|
20
|
-
import "./chunk-
|
|
19
|
+
} from "./chunk-IGHDIWZU.js";
|
|
20
|
+
import "./chunk-32P26BZT.js";
|
|
21
21
|
import "./chunk-JWHYXEA2.js";
|
|
22
22
|
import {
|
|
23
23
|
INSTANCE_SIZES,
|
|
24
24
|
INSTANCE_SIZE_SPEC,
|
|
25
25
|
parseInstanceSize
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-IWKJQZJQ.js";
|
|
27
27
|
import "./chunk-VKVL7WBN.js";
|
|
28
28
|
|
|
29
29
|
// src/sandbox.ts
|
|
@@ -83,6 +83,7 @@ function printHelp() {
|
|
|
83
83
|
" ami list <template-id> List per-template AMI history",
|
|
84
84
|
" ami rebake <template-id> [opts] Trigger a fresh AMI bake (--force, --wait)",
|
|
85
85
|
" ami use <template-id> <ami-row-id> Switch the template to a specific AMI (rollback)",
|
|
86
|
+
" ami use-base <template-id> Reset the template to the base/standard AMI (fresh clone)",
|
|
86
87
|
" build <instance-id> Build and start app services on sandbox",
|
|
87
88
|
" run-command <instance-id> <command...> Execute shell command on sandbox",
|
|
88
89
|
" --service <name> Run inside a Docker container instead of on the host VM",
|
|
@@ -1890,6 +1891,45 @@ async function handleAmiUse(argv, apiUrl, token) {
|
|
|
1890
1891
|
);
|
|
1891
1892
|
}
|
|
1892
1893
|
}
|
|
1894
|
+
async function handleAmiUseBase(argv, apiUrl, token) {
|
|
1895
|
+
const positional = argv.filter((a) => !a.startsWith("-"));
|
|
1896
|
+
const templateId = positional[0];
|
|
1897
|
+
const json = hasFlag(argv, "--json");
|
|
1898
|
+
if (!templateId) {
|
|
1899
|
+
console.error("Error: template ID required.");
|
|
1900
|
+
console.error("Usage: canary sandbox ami use-base <template-id>");
|
|
1901
|
+
process.exit(1);
|
|
1902
|
+
}
|
|
1903
|
+
const res = await apiRequest(
|
|
1904
|
+
apiUrl,
|
|
1905
|
+
token,
|
|
1906
|
+
"DELETE",
|
|
1907
|
+
`/org/environments/templates/${templateId}/current-ami`
|
|
1908
|
+
);
|
|
1909
|
+
if (!res.ok) {
|
|
1910
|
+
if (json) console.log(JSON.stringify(res, null, 2));
|
|
1911
|
+
else console.error(`Error: ${res.error ?? "Unknown error"}`);
|
|
1912
|
+
process.exit(1);
|
|
1913
|
+
}
|
|
1914
|
+
if (json) {
|
|
1915
|
+
console.log(JSON.stringify(res, null, 2));
|
|
1916
|
+
return;
|
|
1917
|
+
}
|
|
1918
|
+
if (res.alreadyBase) {
|
|
1919
|
+
console.log(`Template ${templateId} is already on the base AMI \u2014 nothing to do.`);
|
|
1920
|
+
return;
|
|
1921
|
+
}
|
|
1922
|
+
console.log("Reset to base AMI. Next provision clones fresh from the system base image.");
|
|
1923
|
+
console.log(` Template: ${res.templateId}`);
|
|
1924
|
+
if (res.demotedPriorAmiRowId) {
|
|
1925
|
+
console.log(` Demoted: ${res.demotedPriorAmiRowId} (prior current \u2192 superseded; rollback with \`ami use\`)`);
|
|
1926
|
+
}
|
|
1927
|
+
if (res.priorDemoteSkipped) {
|
|
1928
|
+
console.log(
|
|
1929
|
+
" Warning: prior current row was not in `ready` status \u2014 demote skipped (see server logs)."
|
|
1930
|
+
);
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1893
1933
|
async function handleAmi(argv, apiUrl, token) {
|
|
1894
1934
|
const [action, ...rest] = argv;
|
|
1895
1935
|
switch (action) {
|
|
@@ -1902,13 +1942,17 @@ async function handleAmi(argv, apiUrl, token) {
|
|
|
1902
1942
|
case "use":
|
|
1903
1943
|
await handleAmiUse(rest, apiUrl, token);
|
|
1904
1944
|
break;
|
|
1945
|
+
case "use-base":
|
|
1946
|
+
await handleAmiUseBase(rest, apiUrl, token);
|
|
1947
|
+
break;
|
|
1905
1948
|
default:
|
|
1906
1949
|
console.error(
|
|
1907
|
-
`Unknown ami action: ${action ?? "(none)"}. Use list/rebake/use.
|
|
1950
|
+
`Unknown ami action: ${action ?? "(none)"}. Use list/rebake/use/use-base.
|
|
1908
1951
|
Examples:
|
|
1909
1952
|
canary sandbox ami list <template-id>
|
|
1910
1953
|
canary sandbox ami rebake <template-id> [--force] [--wait]
|
|
1911
|
-
canary sandbox ami use <template-id> <ami-row-id
|
|
1954
|
+
canary sandbox ami use <template-id> <ami-row-id>
|
|
1955
|
+
canary sandbox ami use-base <template-id>`
|
|
1912
1956
|
);
|
|
1913
1957
|
process.exit(1);
|
|
1914
1958
|
}
|
|
@@ -2044,4 +2088,4 @@ export {
|
|
|
2044
2088
|
parseDockerPs,
|
|
2045
2089
|
runSandbox
|
|
2046
2090
|
};
|
|
2047
|
-
//# sourceMappingURL=sandbox-
|
|
2091
|
+
//# sourceMappingURL=sandbox-OOCANWOG.js.map
|