@runcofactor/cli 0.10.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/account-22LMP5PX.js +255 -0
- package/dist/account-22LMP5PX.js.map +1 -0
- package/dist/{api-catalog-GFGCLVS4.js → api-catalog-WTFQNLK6.js} +5 -4
- package/dist/{api-catalog-GFGCLVS4.js.map → api-catalog-WTFQNLK6.js.map} +1 -1
- package/dist/{attachment-SJC7D7FY.js → attachment-U3NKVPEY.js} +5 -4
- package/dist/{attachment-SJC7D7FY.js.map → attachment-U3NKVPEY.js.map} +1 -1
- package/dist/augmentor-5GMNAX4M.js +198 -0
- package/dist/augmentor-5GMNAX4M.js.map +1 -0
- package/dist/{auth-EN6NQCJY.js → auth-VQG2CDUD.js} +3 -2
- package/dist/{chunk-A4OFTUVV.js → chunk-3X3NW7QA.js} +7 -4
- package/dist/chunk-3X3NW7QA.js.map +1 -0
- package/dist/{chunk-N7HFALX3.js → chunk-46IUJXSD.js} +2 -2
- package/dist/{chunk-IMPZAX6L.js → chunk-5GD47G2D.js} +37 -1
- package/dist/{chunk-IMPZAX6L.js.map → chunk-5GD47G2D.js.map} +1 -1
- package/dist/{chunk-B2VISN2V.js → chunk-7VMO2WOZ.js} +238 -68
- package/dist/chunk-7VMO2WOZ.js.map +1 -0
- package/dist/{chunk-QFDOWABX.js → chunk-CMGI7UZD.js} +6 -3
- package/dist/chunk-CMGI7UZD.js.map +1 -0
- package/dist/{chunk-XQXVG7RA.js → chunk-FNPMWDUQ.js} +3 -3
- package/dist/chunk-G4UYGRZR.js +2 -0
- package/dist/{chunk-I4QLI3JO.js → chunk-HDFYUFBI.js} +2 -2
- package/dist/chunk-JMJVGMXI.js +92 -0
- package/dist/chunk-JMJVGMXI.js.map +1 -0
- package/dist/{chunk-SJJW77WN.js → chunk-JYGNMKZ5.js} +129 -38
- package/dist/chunk-JYGNMKZ5.js.map +1 -0
- package/dist/{chunk-52IO7ACJ.js → chunk-KCHKFYVX.js} +68 -10
- package/dist/{chunk-52IO7ACJ.js.map → chunk-KCHKFYVX.js.map} +1 -1
- package/dist/{chunk-ZD3KHESI.js → chunk-KRWRUU6R.js} +27 -7
- package/dist/chunk-KRWRUU6R.js.map +1 -0
- package/dist/{chunk-CLAWT7BJ.js → chunk-NHTEKEYE.js} +3 -3
- package/dist/{chunk-WOHL4FTB.js → chunk-PRBRSIZP.js} +16 -10
- package/dist/chunk-PRBRSIZP.js.map +1 -0
- package/dist/{chunk-GKY2KXO5.js → chunk-UETBLPKM.js} +154 -37
- package/dist/chunk-UETBLPKM.js.map +1 -0
- package/dist/{chunk-4PNOV7OV.js → chunk-VGYN2KU2.js} +9284 -1421
- package/dist/chunk-VGYN2KU2.js.map +1 -0
- package/dist/{chunk-Q4BO4Z5V.js → chunk-XJ5YYYGC.js} +4 -4
- package/dist/{credential-COLTBV6D.js → credential-E6KUHRGU.js} +24 -20
- package/dist/credential-E6KUHRGU.js.map +1 -0
- package/dist/{credential-template-EEPYFG7R.js → credential-template-4GPOPBGD.js} +30 -28
- package/dist/credential-template-4GPOPBGD.js.map +1 -0
- package/dist/{debug-workflow-KOVH5GOP.js → debug-workflow-XCLCY6S7.js} +5 -4
- package/dist/{debug-workflow-KOVH5GOP.js.map → debug-workflow-XCLCY6S7.js.map} +1 -1
- package/dist/{docs-3SSORHB5.js → docs-COCZYMW6.js} +95 -10
- package/dist/docs-COCZYMW6.js.map +1 -0
- package/dist/{doctor-OTSIWV6G.js → doctor-ERIVTCQS.js} +9 -5
- package/dist/doctor-ERIVTCQS.js.map +1 -0
- package/dist/environment-7Y4BV6XY.js +221 -0
- package/dist/environment-7Y4BV6XY.js.map +1 -0
- package/dist/{feature-flag-T2LRZME3.js → feature-flag-MHONEX6T.js} +164 -16
- package/dist/feature-flag-MHONEX6T.js.map +1 -0
- package/dist/index.js +123 -58
- package/dist/index.js.map +1 -1
- package/dist/{init-TGWRECT2.js → init-OROOM4HF.js} +5 -4
- package/dist/{init-TGWRECT2.js.map → init-OROOM4HF.js.map} +1 -1
- package/dist/{install-DXSNWZKO.js → install-OJFXHY6U.js} +7 -7
- package/dist/{issues-XIZOPX6T.js → issues-32GONR6C.js} +5 -4
- package/dist/{issues-XIZOPX6T.js.map → issues-32GONR6C.js.map} +1 -1
- package/dist/{knobs-NBINZIUB.js → knobs-UQGGY3CP.js} +7 -5
- package/dist/knobs-UQGGY3CP.js.map +1 -0
- package/dist/{list-3TDHK637.js → list-ZMIKEC5P.js} +5 -4
- package/dist/{list-3TDHK637.js.map → list-ZMIKEC5P.js.map} +1 -1
- package/dist/{local-HICVD6PU.js → local-PUD24GGQ.js} +7 -6
- package/dist/{local-HICVD6PU.js.map → local-PUD24GGQ.js.map} +1 -1
- package/dist/{login-UOIUXVUK.js → login-BSO7YX2D.js} +5 -4
- package/dist/{login-UOIUXVUK.js.map → login-BSO7YX2D.js.map} +1 -1
- package/dist/{mcp-54IJEOUA.js → mcp-4LS7OJUT.js} +24 -25
- package/dist/mcp-4LS7OJUT.js.map +1 -0
- package/dist/{pdf-extract-ABWV3L5X.js → pdf-extract-YHE54XU4.js} +2 -2
- package/dist/product-3JKSJCBC.js +346 -0
- package/dist/product-3JKSJCBC.js.map +1 -0
- package/dist/{property-UXLOLPTD.js → property-K5DBL4UE.js} +76 -4
- package/dist/property-K5DBL4UE.js.map +1 -0
- package/dist/{psql-BYUUNLGG.js → psql-PQFUFTSE.js} +3 -2
- package/dist/{psql-BYUUNLGG.js.map → psql-PQFUFTSE.js.map} +1 -1
- package/dist/{record-4TR2UIIS.js → record-EIIYLFJ4.js} +16 -17
- package/dist/record-EIIYLFJ4.js.map +1 -0
- package/dist/{redis-35VBUYW7.js → redis-BU36EZZI.js} +3 -2
- package/dist/redis-BU36EZZI.js.map +1 -0
- package/dist/{release-OOLTUBUT.js → release-LYC2P7DZ.js} +5 -4
- package/dist/{release-OOLTUBUT.js.map → release-LYC2P7DZ.js.map} +1 -1
- package/dist/{sandbox-XGSUU6G7.js → sandbox-CKHXXZHU.js} +55 -10
- package/dist/sandbox-CKHXXZHU.js.map +1 -0
- package/dist/{scenarios-GWLJEGHA.js → scenarios-2XJ2G3KR.js} +5 -4
- package/dist/{scenarios-GWLJEGHA.js.map → scenarios-2XJ2G3KR.js.map} +1 -1
- package/dist/{session-MYFNZPRP.js → session-UTOD5ZYH.js} +77 -10
- package/dist/session-UTOD5ZYH.js.map +1 -0
- package/dist/{skill-KM34LDMO.js → skill-GMAERMQL.js} +220 -70
- package/dist/skill-GMAERMQL.js.map +1 -0
- package/dist/skills/debug-run/SKILL.md +40 -23
- package/dist/skills/debug-run/history/1.2.0.md +262 -0
- package/dist/skills/debug-run/history/1.3.0.md +273 -0
- 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 +233 -0
- package/dist/{spec-RA3CFEKG.js → spec-2NP36U3Y.js} +54 -25
- package/dist/spec-2NP36U3Y.js.map +1 -0
- package/dist/{src-LB4HBTJQ.js → src-4T6GHXVO.js} +19 -11
- package/dist/src-4T6GHXVO.js.map +1 -0
- package/dist/{src-N3TPKGTY.js → src-CG52HEE7.js} +10 -7
- package/dist/{src-UVDX5UP6.js → src-PK5OZXCM.js} +4 -2
- package/dist/src-UEOOC425.js +5941 -0
- package/dist/src-UEOOC425.js.map +1 -0
- package/dist/{start-PSEQSQA3.js → start-3C7EEFW2.js} +5 -4
- package/dist/{start-PSEQSQA3.js.map → start-3C7EEFW2.js.map} +1 -1
- package/dist/{tag-YY6YAABQ.js → tag-JSHOMLBR.js} +6 -5
- package/dist/{task-IQC3YR5K.js → task-YGWVYTBJ.js} +5 -4
- package/dist/{task-IQC3YR5K.js.map → task-YGWVYTBJ.js.map} +1 -1
- package/dist/{test-suite-DZNJFXDW.js → test-suite-LI7ZH367.js} +12 -7
- package/dist/{test-suite-DZNJFXDW.js.map → test-suite-LI7ZH367.js.map} +1 -1
- package/dist/trace-UMLOSIIR.js +16 -0
- package/dist/{triage-ORG45R5W.js → triage-ZWJG4NBJ.js} +6 -5
- package/dist/triage-ZWJG4NBJ.js.map +1 -0
- package/dist/{upgrade-L2VYMP2V.js → upgrade-S7CGEK6H.js} +3 -3
- package/dist/{workflow-XYFH5LTP.js → workflow-T4HSAOGW.js} +316 -241
- package/dist/workflow-T4HSAOGW.js.map +1 -0
- package/dist/{workflow-cache-NQJQFWMV.js → workflow-cache-XVEZ36KF.js} +140 -7
- package/dist/workflow-cache-XVEZ36KF.js.map +1 -0
- package/dist/{workflow-debug-BGD4UIXU.js → workflow-debug-T2BULXZ7.js} +9 -8
- package/dist/{workflow-debug-BGD4UIXU.js.map → workflow-debug-T2BULXZ7.js.map} +1 -1
- package/dist/{workflow-proposals-MTUDX46O.js → workflow-proposals-XXEZICN2.js} +5 -6
- package/dist/workflow-proposals-XXEZICN2.js.map +1 -0
- package/package.json +2 -1
- package/dist/chunk-4PNOV7OV.js.map +0 -1
- package/dist/chunk-A4OFTUVV.js.map +0 -1
- package/dist/chunk-B2VISN2V.js.map +0 -1
- package/dist/chunk-GKY2KXO5.js.map +0 -1
- package/dist/chunk-JICSYFRJ.js +0 -46
- package/dist/chunk-JICSYFRJ.js.map +0 -1
- package/dist/chunk-QFDOWABX.js.map +0 -1
- package/dist/chunk-SJJW77WN.js.map +0 -1
- package/dist/chunk-WOHL4FTB.js.map +0 -1
- package/dist/chunk-ZD3KHESI.js.map +0 -1
- package/dist/credential-COLTBV6D.js.map +0 -1
- package/dist/credential-template-EEPYFG7R.js.map +0 -1
- package/dist/docs-3SSORHB5.js.map +0 -1
- package/dist/doctor-OTSIWV6G.js.map +0 -1
- package/dist/feature-flag-T2LRZME3.js.map +0 -1
- package/dist/knobs-NBINZIUB.js.map +0 -1
- package/dist/mcp-54IJEOUA.js.map +0 -1
- package/dist/property-UXLOLPTD.js.map +0 -1
- package/dist/record-4TR2UIIS.js.map +0 -1
- package/dist/redis-35VBUYW7.js.map +0 -1
- package/dist/sandbox-XGSUU6G7.js.map +0 -1
- package/dist/session-MYFNZPRP.js.map +0 -1
- package/dist/skill-KM34LDMO.js.map +0 -1
- package/dist/spec-RA3CFEKG.js.map +0 -1
- package/dist/src-LB4HBTJQ.js.map +0 -1
- package/dist/trace-HXIW7U2D.js +0 -14
- package/dist/workflow-XYFH5LTP.js.map +0 -1
- package/dist/workflow-cache-NQJQFWMV.js.map +0 -1
- package/dist/workflow-proposals-MTUDX46O.js.map +0 -1
- /package/dist/{auth-EN6NQCJY.js.map → auth-VQG2CDUD.js.map} +0 -0
- /package/dist/{chunk-N7HFALX3.js.map → chunk-46IUJXSD.js.map} +0 -0
- /package/dist/{chunk-XQXVG7RA.js.map → chunk-FNPMWDUQ.js.map} +0 -0
- /package/dist/{pdf-extract-ABWV3L5X.js.map → chunk-G4UYGRZR.js.map} +0 -0
- /package/dist/{chunk-I4QLI3JO.js.map → chunk-HDFYUFBI.js.map} +0 -0
- /package/dist/{chunk-CLAWT7BJ.js.map → chunk-NHTEKEYE.js.map} +0 -0
- /package/dist/{chunk-Q4BO4Z5V.js.map → chunk-XJ5YYYGC.js.map} +0 -0
- /package/dist/{install-DXSNWZKO.js.map → install-OJFXHY6U.js.map} +0 -0
- /package/dist/{src-N3TPKGTY.js.map → pdf-extract-YHE54XU4.js.map} +0 -0
- /package/dist/{src-UVDX5UP6.js.map → src-CG52HEE7.js.map} +0 -0
- /package/dist/{tag-YY6YAABQ.js.map → src-PK5OZXCM.js.map} +0 -0
- /package/dist/{trace-HXIW7U2D.js.map → tag-JSHOMLBR.js.map} +0 -0
- /package/dist/{triage-ORG45R5W.js.map → trace-UMLOSIIR.js.map} +0 -0
- /package/dist/{upgrade-L2VYMP2V.js.map → upgrade-S7CGEK6H.js.map} +0 -0
|
@@ -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-PRBRSIZP.js";
|
|
6
|
+
import "./chunk-3CZU7XCS.js";
|
|
7
|
+
import {
|
|
8
|
+
getArgValue,
|
|
9
|
+
hasFlag,
|
|
10
|
+
resolveConfig
|
|
11
|
+
} from "./chunk-3X3NW7QA.js";
|
|
12
|
+
import "./chunk-JMJVGMXI.js";
|
|
13
|
+
import "./chunk-JWHYXEA2.js";
|
|
14
|
+
import "./chunk-JYGNMKZ5.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-3JKSJCBC.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,MAAM;AACvC,QAAM,WAAW,YAAY,MAAM,YAAY;AAC/C,MAAI,SAAU,QAAO,IAAI,YAAY,QAAQ;AAC7C,MAAI,QAAQ,MAAM,sBAAsB,EAAG,QAAO,IAAI,qBAAqB,MAAM;A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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,15 +3,16 @@ import {
|
|
|
3
3
|
apiRequest,
|
|
4
4
|
fetchProperties,
|
|
5
5
|
getApplicationArg
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-SJJW77WN.js";
|
|
6
|
+
} from "./chunk-PRBRSIZP.js";
|
|
8
7
|
import "./chunk-3CZU7XCS.js";
|
|
9
8
|
import {
|
|
10
9
|
getArgValue,
|
|
11
10
|
hasFlag,
|
|
12
11
|
resolveConfig
|
|
13
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-3X3NW7QA.js";
|
|
13
|
+
import "./chunk-JMJVGMXI.js";
|
|
14
14
|
import "./chunk-JWHYXEA2.js";
|
|
15
|
+
import "./chunk-JYGNMKZ5.js";
|
|
15
16
|
import "./chunk-VKVL7WBN.js";
|
|
16
17
|
|
|
17
18
|
// src/property.ts
|
|
@@ -448,6 +449,7 @@ function printHelp() {
|
|
|
448
449
|
"Sub-commands:",
|
|
449
450
|
" list List all applications",
|
|
450
451
|
" create [options] Create a new application",
|
|
452
|
+
" update <name|id> [options] Update application settings",
|
|
451
453
|
" repo link [options] Link a GitHub repo to an application",
|
|
452
454
|
" repo update [options] Update an existing repo link",
|
|
453
455
|
" repo unlink [options] Unlink a GitHub repo from an application",
|
|
@@ -459,6 +461,12 @@ function printHelp() {
|
|
|
459
461
|
" --description <text> Optional description",
|
|
460
462
|
" --agent-context <text> Optional agent context (max 8000 chars)",
|
|
461
463
|
" --env-var <NAME[:sensitive]> Declare a per-environment variable (repeatable); values set per-environment, injected as $var.ENV.<NAME>",
|
|
464
|
+
" --login-path </path> Relative login page path appended to the environment URL (e.g. /login)",
|
|
465
|
+
"",
|
|
466
|
+
"Update options:",
|
|
467
|
+
" --login-path </path> Set the relative login page path (empty string clears it)",
|
|
468
|
+
" --description <text> Set the description",
|
|
469
|
+
" --agent-context <text> Set the agent context",
|
|
462
470
|
"",
|
|
463
471
|
"Repo link/update/unlink options:",
|
|
464
472
|
" --application <app_xxx|uuid> Application ID (required; alias: --property)",
|
|
@@ -525,6 +533,7 @@ async function handleCreate(argv, apiUrl, token) {
|
|
|
525
533
|
const baseUrl = getArgValue(argv, "--base-url");
|
|
526
534
|
const description = getArgValue(argv, "--description");
|
|
527
535
|
const agentContext = getArgValue(argv, "--agent-context");
|
|
536
|
+
const loginPath = getArgValue(argv, "--login-path");
|
|
528
537
|
const envVarDefinitions = parseEnvVarDefinitions(argv);
|
|
529
538
|
if (!name || !baseUrl) {
|
|
530
539
|
console.error("Error: --name and --base-url are required.");
|
|
@@ -534,6 +543,7 @@ async function handleCreate(argv, apiUrl, token) {
|
|
|
534
543
|
const body = { name, baseUrl };
|
|
535
544
|
if (description !== void 0) body.description = description;
|
|
536
545
|
if (agentContext !== void 0) body.agentContext = agentContext;
|
|
546
|
+
if (loginPath !== void 0) body.loginPath = loginPath;
|
|
537
547
|
if (envVarDefinitions.length > 0) body.envVarDefinitions = envVarDefinitions;
|
|
538
548
|
const result = await apiRequest(
|
|
539
549
|
apiUrl,
|
|
@@ -556,6 +566,65 @@ async function handleCreate(argv, apiUrl, token) {
|
|
|
556
566
|
}
|
|
557
567
|
console.log(`Created application "${name}" (${result.id})`);
|
|
558
568
|
}
|
|
569
|
+
async function handleUpdate(argv, apiUrl, token) {
|
|
570
|
+
const json = hasFlag(argv, "--json");
|
|
571
|
+
const appArg = argv.find((a) => !a.startsWith("-")) ?? getApplicationArg(argv);
|
|
572
|
+
const loginPath = getArgValue(argv, "--login-path");
|
|
573
|
+
const description = getArgValue(argv, "--description");
|
|
574
|
+
const agentContext = getArgValue(argv, "--agent-context");
|
|
575
|
+
if (!appArg) {
|
|
576
|
+
console.error("Error: Missing application name or ID.");
|
|
577
|
+
console.error("Usage: canary application update <name|id> [--login-path </path>] [--description <text>]");
|
|
578
|
+
process2.exit(1);
|
|
579
|
+
}
|
|
580
|
+
if (loginPath === void 0 && description === void 0 && agentContext === void 0) {
|
|
581
|
+
console.error(
|
|
582
|
+
"Error: No fields to update. Provide at least one of: --login-path, --description, --agent-context"
|
|
583
|
+
);
|
|
584
|
+
process2.exit(1);
|
|
585
|
+
}
|
|
586
|
+
const properties = await fetchProperties(apiUrl, token);
|
|
587
|
+
const property = properties.find(
|
|
588
|
+
(p) => p.id === appArg || p.name.toLowerCase() === appArg.toLowerCase()
|
|
589
|
+
);
|
|
590
|
+
if (!property) {
|
|
591
|
+
console.error(`Error: Application "${appArg}" not found.`);
|
|
592
|
+
if (properties.length > 0) {
|
|
593
|
+
console.error("Available applications:");
|
|
594
|
+
for (const p of properties) console.error(` - ${p.name} (${p.id})`);
|
|
595
|
+
}
|
|
596
|
+
process2.exit(1);
|
|
597
|
+
}
|
|
598
|
+
const body = {};
|
|
599
|
+
if (loginPath !== void 0) body.loginPath = loginPath;
|
|
600
|
+
if (description !== void 0) body.description = description;
|
|
601
|
+
if (agentContext !== void 0) body.agentContext = agentContext;
|
|
602
|
+
const result = await apiRequest(
|
|
603
|
+
apiUrl,
|
|
604
|
+
token,
|
|
605
|
+
"PUT",
|
|
606
|
+
`/org/properties/${property.id}`,
|
|
607
|
+
body
|
|
608
|
+
);
|
|
609
|
+
if (!result.ok) {
|
|
610
|
+
if (json) {
|
|
611
|
+
console.log(JSON.stringify(result, null, 2));
|
|
612
|
+
} else {
|
|
613
|
+
console.error(`Error: ${result.error ?? "Unknown error"}`);
|
|
614
|
+
}
|
|
615
|
+
process2.exit(1);
|
|
616
|
+
}
|
|
617
|
+
if (json) {
|
|
618
|
+
console.log(JSON.stringify({ ok: true, applicationId: property.id, updated: body }, null, 2));
|
|
619
|
+
return;
|
|
620
|
+
}
|
|
621
|
+
console.log(`Updated application "${property.name}" (${property.id}):`);
|
|
622
|
+
if (loginPath !== void 0) {
|
|
623
|
+
console.log(` loginPath: -> ${loginPath || "(cleared \u2014 sessions start at the environment URL)"}`);
|
|
624
|
+
}
|
|
625
|
+
if (description !== void 0) console.log(" description: updated");
|
|
626
|
+
if (agentContext !== void 0) console.log(" agentContext: updated");
|
|
627
|
+
}
|
|
559
628
|
async function handleRepoLink(argv, apiUrl, token) {
|
|
560
629
|
const json = hasFlag(argv, "--json");
|
|
561
630
|
const propertyId = getApplicationArg(argv);
|
|
@@ -683,6 +752,9 @@ async function runProperty(argv) {
|
|
|
683
752
|
case "create":
|
|
684
753
|
await handleCreate(args, apiUrl, token);
|
|
685
754
|
break;
|
|
755
|
+
case "update":
|
|
756
|
+
await handleUpdate(args, apiUrl, token);
|
|
757
|
+
break;
|
|
686
758
|
case "repo":
|
|
687
759
|
await handleRepo(args, apiUrl, token);
|
|
688
760
|
break;
|
|
@@ -698,4 +770,4 @@ async function runProperty(argv) {
|
|
|
698
770
|
export {
|
|
699
771
|
runProperty
|
|
700
772
|
};
|
|
701
|
-
//# sourceMappingURL=property-
|
|
773
|
+
//# sourceMappingURL=property-K5DBL4UE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/property.ts","../src/property-skill.ts"],"sourcesContent":["/**\n * CLI Property Management\n *\n * List properties and their linked GitHub repos.\n */\n\nimport process from 'node:process';\nimport { resolveConfig, hasFlag, getArgValue } from './auth.js';\nimport { fetchProperties, apiRequest, getApplicationArg } from './cli-helpers.js';\nimport { runPropertySkill } from './property-skill.js';\n\nfunction pad(s: string, n: number): string {\n return s.padEnd(n);\n}\n\nfunction printHelp(): void {\n console.log(\n [\n 'canary application: Manage applications (alias: canary property)',\n '',\n 'Sub-commands:',\n ' list List all applications',\n ' create [options] Create a new application',\n ' update <name|id> [options] Update application settings',\n ' repo link [options] Link a GitHub repo to an application',\n ' repo update [options] Update an existing repo link',\n ' repo unlink [options] Unlink a GitHub repo from an application',\n ' skill <action> [options] Manage the application\\'s app skill (run `canary application skill help` for details)',\n '',\n 'Create options:',\n ' --name <name> Application name (required)',\n ' --base-url <url> Application base URL (required)',\n ' --description <text> Optional description',\n ' --agent-context <text> Optional agent context (max 8000 chars)',\n ' --env-var <NAME[:sensitive]> Declare a per-environment variable (repeatable); values set per-environment, injected as $var.ENV.<NAME>',\n ' --login-path </path> Relative login page path appended to the environment URL (e.g. /login)',\n '',\n 'Update options:',\n ' --login-path </path> Set the relative login page path (empty string clears it)',\n ' --description <text> Set the description',\n ' --agent-context <text> Set the agent context',\n '',\n 'Repo link/update/unlink options:',\n ' --application <app_xxx|uuid> Application ID (required; alias: --property)',\n ' --repo <owner/name> Repo full name (required for link/unlink)',\n ' --repo-id <uuid> Repo link UUID (required for update)',\n ' --role <frontend|backend|...> Conventional role (free-form)',\n ' --root-dir <path> Monorepo subdirectory hint',\n ' --agent-hint <text> Free-form hint for the planner agent',\n '',\n 'Common options:',\n ' --json Output as JSON',\n ].join('\\n')\n );\n}\n\ntype GitHubRepo = {\n id: string;\n repoFullName: string;\n repoName: string;\n defaultBranch: string;\n rootDir: string | null;\n role: string | null;\n};\n\nasync function handleList(argv: string[], apiUrl: string, token: string): Promise<void> {\n const json = hasFlag(argv, '--json');\n const properties = await fetchProperties(apiUrl, token);\n\n if (json) {\n console.log(JSON.stringify(properties, null, 2));\n return;\n }\n\n if (properties.length === 0) {\n console.log('No applications found.');\n return;\n }\n\n console.log(`${pad('Name', 30)} ${pad('Base URL', 40)} ID`);\n for (const p of properties) {\n console.log(`${pad(p.name, 30)} ${pad(p.baseUrl, 40)} ${p.id}`);\n }\n\n // Show linked repos for each property\n console.log('');\n for (const p of properties) {\n const reposRes = await apiRequest<{ ok: boolean; items: GitHubRepo[] }>(\n apiUrl, token, 'GET', `/org/properties/${p.id}/github-repos`\n );\n const repos = reposRes.ok ? (reposRes.items ?? []) : [];\n if (repos.length > 0) {\n console.log(`${p.name} repos:`);\n for (const r of repos) {\n const dir = r.rootDir && r.rootDir !== '/' ? ` (${r.rootDir})` : '';\n const role = r.role ? ` [${r.role}]` : '';\n console.log(` ${r.repoFullName}:${r.defaultBranch}${role}${dir}`);\n }\n }\n }\n}\n\n/**\n * Parse repeatable `--env-var NAME[:sensitive]` flags into env-var definitions.\n * Examples: `--env-var API_URL`, `--env-var API_TOKEN:sensitive`.\n */\nfunction parseEnvVarDefinitions(\n argv: string[]\n): Array<{ name: string; sensitive?: boolean }> {\n const defs: Array<{ name: string; sensitive?: boolean }> = [];\n for (let i = 0; i < argv.length; i++) {\n if (argv[i] !== '--env-var') continue;\n const raw = argv[i + 1];\n if (!raw || raw.startsWith('-')) continue;\n const [name, modifier] = raw.split(':');\n if (!name) continue;\n // Accept `NAME` or `NAME:sensitive`; ignore-with-no-effect any other suffix.\n defs.push({ name, ...(modifier === 'sensitive' ? { sensitive: true } : {}) });\n }\n return defs;\n}\n\nasync function handleCreate(argv: string[], apiUrl: string, token: string): Promise<void> {\n const json = hasFlag(argv, '--json');\n const name = getArgValue(argv, '--name');\n const baseUrl = getArgValue(argv, '--base-url');\n const description = getArgValue(argv, '--description');\n const agentContext = getArgValue(argv, '--agent-context');\n const loginPath = getArgValue(argv, '--login-path');\n const envVarDefinitions = parseEnvVarDefinitions(argv);\n\n if (!name || !baseUrl) {\n console.error('Error: --name and --base-url are required.');\n console.error('Usage: canary application create --name <name> --base-url <url>');\n process.exit(1);\n }\n\n const body: Record<string, unknown> = { name, baseUrl };\n if (description !== undefined) body.description = description;\n if (agentContext !== undefined) body.agentContext = agentContext;\n if (loginPath !== undefined) body.loginPath = loginPath;\n if (envVarDefinitions.length > 0) body.envVarDefinitions = envVarDefinitions;\n\n const result = await apiRequest<{ ok: boolean; id?: string; error?: string }>(\n apiUrl,\n token,\n 'POST',\n '/org/properties',\n body\n );\n\n if (!result.ok) {\n if (json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.error(`Error: ${result.error ?? 'Unknown error'}`);\n }\n process.exit(1);\n }\n\n if (json) {\n console.log(JSON.stringify(result, null, 2));\n return;\n }\n\n console.log(`Created application \"${name}\" (${result.id})`);\n}\n\nasync function handleUpdate(argv: string[], apiUrl: string, token: string): Promise<void> {\n const json = hasFlag(argv, '--json');\n const appArg = argv.find((a) => !a.startsWith('-')) ?? getApplicationArg(argv);\n const loginPath = getArgValue(argv, '--login-path');\n const description = getArgValue(argv, '--description');\n const agentContext = getArgValue(argv, '--agent-context');\n\n if (!appArg) {\n console.error('Error: Missing application name or ID.');\n console.error('Usage: canary application update <name|id> [--login-path </path>] [--description <text>]');\n process.exit(1);\n }\n if (loginPath === undefined && description === undefined && agentContext === undefined) {\n console.error(\n 'Error: No fields to update. Provide at least one of: --login-path, --description, --agent-context'\n );\n process.exit(1);\n }\n\n const properties = await fetchProperties(apiUrl, token);\n const property = properties.find(\n (p) => p.id === appArg || p.name.toLowerCase() === appArg.toLowerCase()\n );\n if (!property) {\n console.error(`Error: Application \"${appArg}\" not found.`);\n if (properties.length > 0) {\n console.error('Available applications:');\n for (const p of properties) console.error(` - ${p.name} (${p.id})`);\n }\n process.exit(1);\n }\n\n const body: Record<string, unknown> = {};\n // Empty string clears the login path (sessions start at the environment URL).\n if (loginPath !== undefined) body.loginPath = loginPath;\n if (description !== undefined) body.description = description;\n if (agentContext !== undefined) body.agentContext = agentContext;\n\n const result = await apiRequest<{ ok: boolean; error?: string }>(\n apiUrl,\n token,\n 'PUT',\n `/org/properties/${property.id}`,\n body\n );\n\n if (!result.ok) {\n if (json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.error(`Error: ${result.error ?? 'Unknown error'}`);\n }\n process.exit(1);\n }\n\n if (json) {\n console.log(JSON.stringify({ ok: true, applicationId: property.id, updated: body }, null, 2));\n return;\n }\n\n console.log(`Updated application \"${property.name}\" (${property.id}):`);\n if (loginPath !== undefined) {\n console.log(` loginPath: -> ${loginPath || '(cleared — sessions start at the environment URL)'}`);\n }\n if (description !== undefined) console.log(' description: updated');\n if (agentContext !== undefined) console.log(' agentContext: updated');\n}\n\nasync function handleRepoLink(argv: string[], apiUrl: string, token: string): Promise<void> {\n const json = hasFlag(argv, '--json');\n const propertyId = getApplicationArg(argv);\n const repo = getArgValue(argv, '--repo');\n const role = getArgValue(argv, '--role');\n const rootDir = getArgValue(argv, '--root-dir');\n const agentHint = getArgValue(argv, '--agent-hint');\n\n if (!propertyId || !repo) {\n console.error('Error: --application and --repo are required.');\n process.exit(1);\n }\n\n const body: Record<string, unknown> = { repoFullName: repo };\n if (role !== undefined) body.role = role;\n if (rootDir !== undefined) body.rootDir = rootDir;\n if (agentHint !== undefined) body.agentHint = agentHint;\n\n const result = await apiRequest<{ ok: boolean; id?: string; error?: string }>(\n apiUrl,\n token,\n 'POST',\n `/org/properties/${propertyId}/github-repos`,\n body\n );\n\n if (!result.ok) {\n if (json) console.log(JSON.stringify(result, null, 2));\n else console.error(`Error: ${result.error ?? 'Unknown error'}`);\n process.exit(1);\n }\n\n if (json) console.log(JSON.stringify(result, null, 2));\n else console.log(`Linked ${repo} to application ${propertyId} (${result.id})`);\n}\n\nasync function handleRepoUpdate(argv: string[], apiUrl: string, token: string): Promise<void> {\n const json = hasFlag(argv, '--json');\n const propertyId = getApplicationArg(argv);\n const repoId = getArgValue(argv, '--repo-id');\n const role = getArgValue(argv, '--role');\n const rootDir = getArgValue(argv, '--root-dir');\n const agentHint = getArgValue(argv, '--agent-hint');\n\n if (!propertyId || !repoId) {\n console.error('Error: --application and --repo-id are required.');\n process.exit(1);\n }\n\n const body: Record<string, unknown> = {};\n if (role !== undefined) body.role = role;\n if (rootDir !== undefined) body.rootDir = rootDir;\n if (agentHint !== undefined) body.agentHint = agentHint;\n\n const result = await apiRequest<{ ok: boolean; id?: string; error?: string }>(\n apiUrl,\n token,\n 'PATCH',\n `/org/properties/${propertyId}/github-repos/${repoId}`,\n body\n );\n\n if (!result.ok) {\n if (json) console.log(JSON.stringify(result, null, 2));\n else console.error(`Error: ${result.error ?? 'Unknown error'}`);\n process.exit(1);\n }\n\n if (json) console.log(JSON.stringify(result, null, 2));\n else console.log(`Updated repo link ${repoId}`);\n}\n\nasync function handleRepoUnlink(argv: string[], apiUrl: string, token: string): Promise<void> {\n const json = hasFlag(argv, '--json');\n const propertyId = getApplicationArg(argv);\n const repo = getArgValue(argv, '--repo');\n\n if (!propertyId || !repo) {\n console.error('Error: --application and --repo are required.');\n process.exit(1);\n }\n\n const result = await apiRequest<{ ok: boolean; error?: string }>(\n apiUrl,\n token,\n 'DELETE',\n `/org/properties/${propertyId}/github-repos/${encodeURIComponent(repo)}`\n );\n\n if (!result.ok) {\n if (json) console.log(JSON.stringify(result, null, 2));\n else console.error(`Error: ${result.error ?? 'Unknown error'}`);\n process.exit(1);\n }\n\n if (json) console.log(JSON.stringify(result, null, 2));\n else console.log(`Unlinked ${repo} from application ${propertyId}`);\n}\n\nasync function handleRepo(argv: string[], apiUrl: string, token: string): Promise<void> {\n const [action, ...rest] = argv;\n switch (action) {\n case 'link':\n await handleRepoLink(rest, apiUrl, token);\n break;\n case 'update':\n await handleRepoUpdate(rest, apiUrl, token);\n break;\n case 'unlink':\n await handleRepoUnlink(rest, apiUrl, token);\n break;\n default:\n console.error(`Unknown repo action: ${action ?? '(none)'}`);\n printHelp();\n process.exit(1);\n }\n}\n\nexport async function runProperty(argv: string[]): Promise<void> {\n const [subCommand, ...rest] = argv;\n\n if (!subCommand || subCommand === 'help' || hasFlag(argv, '--help', '-h')) {\n printHelp();\n return;\n }\n\n // `skill guide` and `skill help` are doc-only; skip auth resolution so\n // unauthenticated agents can discover the methodology before logging in.\n if (subCommand === 'skill') {\n const skillAction = rest[0];\n if (!skillAction || skillAction === 'help' || skillAction === 'guide') {\n await runPropertySkill(rest, '', '');\n return;\n }\n }\n\n const { apiUrl, token } = await resolveConfig(argv);\n\n const globalFlags = new Set(['--env', '--api-url', '--token']);\n const args = rest.filter((arg, i) => {\n if (globalFlags.has(arg)) return false;\n if (i > 0 && globalFlags.has(rest[i - 1])) return false;\n return true;\n });\n\n switch (subCommand) {\n case 'list':\n await handleList(args, apiUrl, token);\n break;\n case 'create':\n await handleCreate(args, apiUrl, token);\n break;\n case 'update':\n await handleUpdate(args, apiUrl, token);\n break;\n case 'repo':\n await handleRepo(args, apiUrl, token);\n break;\n case 'skill':\n await runPropertySkill(args, apiUrl, token);\n break;\n default:\n console.error(`Unknown sub-command: ${subCommand}`);\n printHelp();\n process.exit(1);\n }\n}\n","/**\n * CLI: `canary property skill` — manage a property's app skill\n *\n * App skill = the per-property knowledge base injected into the cloud workflow\n * browser agent's system prompt. CLI is a thin client over the existing\n * /org/properties/:id/context endpoints. Source defaults to 'cli' so authored\n * items are distinguishable from browser-bootstrap or human-manual edits.\n */\n\nimport { readFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport process from 'node:process';\nimport { getArgValue, hasFlag } from './auth.js';\nimport { apiRequest, getApplicationArg } from './cli-helpers.js';\n\nconst HERE = dirname(fileURLToPath(import.meta.url));\nconst GUIDE_PATH = join(HERE, 'property-skill-guide.md');\n\nconst SECTIONS = [\n 'general',\n 'technology',\n 'product',\n 'ui',\n 'tenancy',\n 'auth',\n 'roles_permissions',\n 'navigation',\n 'feature_gating',\n 'environments',\n 'data_lifecycle',\n 'async_realtime',\n 'localization',\n 'feedback_errors',\n 'idiosyncrasies',\n] as const;\ntype Section = (typeof SECTIONS)[number];\n\ntype ContextItem = {\n id: string;\n propertyId: string;\n section: Section;\n itemKey: string;\n itemLabel: string;\n content: string;\n version: number;\n source: 'bootstrap' | 'workflow' | 'manual' | 'cli';\n sourceId: string | null;\n createdBy: string | null;\n createdAt: string;\n};\n\ntype ListResponse = {\n ok: boolean;\n error?: string;\n data?: { items: ContextItem[]; grouped: Record<string, ContextItem[]> };\n};\n\nfunction printSkillHelp(): void {\n console.log(\n [\n 'canary application skill: Manage an application\\'s app skill (per-application knowledge for QA browser agents). Alias: canary property skill. (--property accepted as an alias for --application.)',\n '',\n 'Sub-commands:',\n ' guide Print the full authoring methodology (start here)',\n ' list [--application <id>] [--section S] [--format json|table]',\n ' get --application <id> --section S --key K [--version N] [--format json|md]',\n ' set --application <id> --section S --key K --label L --content @file|\"text\" [--source-id <repo@sha>]',\n ' delete --application <id> --section S --key K',\n ' history --application <id> --section S --key K [--format json|table]',\n ' export --application <id> [--format md|json]',\n ' import --application <id> --file <bundle.json> [--source-id <repo@sha>]',\n '',\n 'New to app skills? Run `canary application skill guide` for the authoring methodology.',\n '',\n 'Sections:',\n ' ' + SECTIONS.join(', '),\n '',\n 'Notes:',\n ' --content @path reads content from a file (preferred for multi-line markdown)',\n ' --content \"text\" literal content string',\n ' Source defaults to \"cli\". Provide --source-id <repo@sha> for provenance.',\n '',\n 'Bundle.json shape for import:',\n ' { \"items\": [ { \"section\": S, \"itemKey\": K, \"itemLabel\": L, \"content\": \"...\" }, ... ] }',\n ].join('\\n')\n );\n}\n\nfunction readContent(value: string): string {\n if (value.startsWith('@')) {\n const path = value.slice(1);\n return readFileSync(path, 'utf8');\n }\n return value;\n}\n\nfunction isSection(s: string | undefined): s is Section {\n return !!s && (SECTIONS as readonly string[]).includes(s);\n}\n\nasync function handleList(argv: string[], apiUrl: string, token: string): Promise<void> {\n const propertyId = getApplicationArg(argv);\n const section = getArgValue(argv, '--section');\n const format = getArgValue(argv, '--format') ?? (hasFlag(argv, '--json') ? 'json' : 'table');\n\n if (!propertyId) {\n console.error('Error: --application is required (alias: --property).');\n process.exit(1);\n }\n\n const result = await apiRequest<ListResponse>(\n apiUrl,\n token,\n 'GET',\n `/org/properties/${propertyId}/context`\n );\n\n if (!result.ok) {\n console.error(`Error: ${result.error ?? 'Unknown error'}`);\n process.exit(1);\n }\n\n let items = result.data?.items ?? [];\n if (section) items = items.filter((i) => i.section === section);\n\n if (format === 'json') {\n console.log(JSON.stringify(items, null, 2));\n return;\n }\n\n if (items.length === 0) {\n console.log('(no items)');\n return;\n }\n\n const grouped = new Map<string, ContextItem[]>();\n for (const item of items) {\n const arr = grouped.get(item.section) ?? [];\n arr.push(item);\n grouped.set(item.section, arr);\n }\n\n for (const sec of SECTIONS) {\n const arr = grouped.get(sec);\n if (!arr || arr.length === 0) continue;\n console.log(`\\n[${sec}]`);\n for (const item of arr) {\n const provenance = item.source === 'cli' && item.sourceId ? ` (${item.sourceId})` : item.source !== 'cli' ? ` (${item.source})` : '';\n console.log(` ${item.itemKey} — ${item.itemLabel}${provenance}`);\n }\n }\n}\n\nasync function handleGet(argv: string[], apiUrl: string, token: string): Promise<void> {\n const propertyId = getApplicationArg(argv);\n const section = getArgValue(argv, '--section');\n const itemKey = getArgValue(argv, '--key');\n const versionArg = getArgValue(argv, '--version');\n const format = getArgValue(argv, '--format') ?? 'md';\n\n if (!propertyId || !section || !itemKey) {\n console.error('Error: --application, --section, --key are required.');\n process.exit(1);\n }\n if (!isSection(section)) {\n console.error(`Error: invalid section \"${section}\". One of: ${SECTIONS.join(', ')}`);\n process.exit(1);\n }\n\n // Current value comes from list; specific version from history.\n if (versionArg) {\n const v = Number(versionArg);\n const result = await apiRequest<{ ok: boolean; error?: string; data?: ContextItem[] }>(\n apiUrl,\n token,\n 'GET',\n `/org/properties/${propertyId}/context/history?section=${section}&itemKey=${encodeURIComponent(itemKey)}`\n );\n if (!result.ok) {\n console.error(`Error: ${result.error ?? 'Unknown error'}`);\n process.exit(1);\n }\n const item = (result.data ?? []).find((i) => i.version === v);\n if (!item) {\n console.error(`Error: no version ${v} for ${section}/${itemKey}`);\n process.exit(1);\n }\n printItem(item, format);\n return;\n }\n\n const result = await apiRequest<ListResponse>(\n apiUrl,\n token,\n 'GET',\n `/org/properties/${propertyId}/context`\n );\n if (!result.ok) {\n console.error(`Error: ${result.error ?? 'Unknown error'}`);\n process.exit(1);\n }\n const item = (result.data?.items ?? []).find(\n (i) => i.section === section && i.itemKey === itemKey\n );\n if (!item) {\n console.error(`Error: no item ${section}/${itemKey}`);\n process.exit(1);\n }\n printItem(item, format);\n}\n\nfunction printItem(item: ContextItem, format: string): void {\n if (format === 'json') {\n console.log(JSON.stringify(item, null, 2));\n return;\n }\n console.log(`# ${item.itemLabel}`);\n console.log(`section: ${item.section}`);\n console.log(`key: ${item.itemKey}`);\n console.log(`version: ${item.version}`);\n console.log(`source: ${item.source}${item.sourceId ? ` (${item.sourceId})` : ''}`);\n console.log('');\n console.log(item.content);\n}\n\nasync function handleSet(argv: string[], apiUrl: string, token: string): Promise<void> {\n const propertyId = getApplicationArg(argv);\n const section = getArgValue(argv, '--section');\n const itemKey = getArgValue(argv, '--key');\n const itemLabel = getArgValue(argv, '--label');\n const contentArg = getArgValue(argv, '--content');\n const sourceId = getArgValue(argv, '--source-id');\n\n if (!propertyId || !section || !itemKey || !itemLabel || contentArg === undefined) {\n console.error('Error: --application, --section, --key, --label, --content are required.');\n process.exit(1);\n }\n if (!isSection(section)) {\n console.error(`Error: invalid section \"${section}\". One of: ${SECTIONS.join(', ')}`);\n process.exit(1);\n }\n\n const content = readContent(contentArg);\n\n const body: Record<string, unknown> = {\n section,\n itemKey,\n itemLabel,\n content,\n source: 'cli',\n };\n if (sourceId !== undefined) body.sourceId = sourceId;\n\n const result = await apiRequest<{ ok: boolean; error?: string; data?: ContextItem }>(\n apiUrl,\n token,\n 'PUT',\n `/org/properties/${propertyId}/context/items`,\n body\n );\n\n if (!result.ok) {\n console.error(`Error: ${result.error ?? 'Unknown error'}`);\n process.exit(1);\n }\n\n console.log(`Set [${section}] ${itemKey} (v${result.data?.version ?? '?'})`);\n}\n\nasync function handleDelete(argv: string[], apiUrl: string, token: string): Promise<void> {\n const propertyId = getApplicationArg(argv);\n const section = getArgValue(argv, '--section');\n const itemKey = getArgValue(argv, '--key');\n\n if (!propertyId || !section || !itemKey) {\n console.error('Error: --application, --section, --key are required.');\n process.exit(1);\n }\n if (!isSection(section)) {\n console.error(`Error: invalid section \"${section}\". One of: ${SECTIONS.join(', ')}`);\n process.exit(1);\n }\n\n const result = await apiRequest<{ ok: boolean; error?: string }>(\n apiUrl,\n token,\n 'DELETE',\n `/org/properties/${propertyId}/context/items`,\n { section, itemKey }\n );\n\n if (!result.ok) {\n console.error(`Error: ${result.error ?? 'Unknown error'}`);\n process.exit(1);\n }\n\n console.log(`Deleted [${section}] ${itemKey}`);\n}\n\nasync function handleHistory(argv: string[], apiUrl: string, token: string): Promise<void> {\n const propertyId = getApplicationArg(argv);\n const section = getArgValue(argv, '--section');\n const itemKey = getArgValue(argv, '--key');\n const format = getArgValue(argv, '--format') ?? 'table';\n\n if (!propertyId || !section || !itemKey) {\n console.error('Error: --application, --section, --key are required.');\n process.exit(1);\n }\n if (!isSection(section)) {\n console.error(`Error: invalid section \"${section}\". One of: ${SECTIONS.join(', ')}`);\n process.exit(1);\n }\n\n const result = await apiRequest<{ ok: boolean; error?: string; data?: ContextItem[] }>(\n apiUrl,\n token,\n 'GET',\n `/org/properties/${propertyId}/context/history?section=${section}&itemKey=${encodeURIComponent(itemKey)}`\n );\n\n if (!result.ok) {\n console.error(`Error: ${result.error ?? 'Unknown error'}`);\n process.exit(1);\n }\n\n const versions = result.data ?? [];\n if (format === 'json') {\n console.log(JSON.stringify(versions, null, 2));\n return;\n }\n if (versions.length === 0) {\n console.log('(no history)');\n return;\n }\n for (const v of versions) {\n const provenance = v.sourceId ? ` (${v.sourceId})` : '';\n console.log(`v${v.version} ${v.source}${provenance} ${v.createdAt}`);\n }\n}\n\nasync function handleExport(argv: string[], apiUrl: string, token: string): Promise<void> {\n const propertyId = getApplicationArg(argv);\n const format = getArgValue(argv, '--format') ?? 'md';\n\n if (!propertyId) {\n console.error('Error: --application is required (alias: --property).');\n process.exit(1);\n }\n\n const result = await apiRequest<ListResponse>(\n apiUrl,\n token,\n 'GET',\n `/org/properties/${propertyId}/context`\n );\n\n if (!result.ok) {\n console.error(`Error: ${result.error ?? 'Unknown error'}`);\n process.exit(1);\n }\n\n const items = result.data?.items ?? [];\n if (format === 'json') {\n console.log(JSON.stringify({ items }, null, 2));\n return;\n }\n\n const grouped = new Map<string, ContextItem[]>();\n for (const item of items) {\n const arr = grouped.get(item.section) ?? [];\n arr.push(item);\n grouped.set(item.section, arr);\n }\n for (const sec of SECTIONS) {\n const arr = grouped.get(sec);\n if (!arr || arr.length === 0) continue;\n console.log(`## ${sec}`);\n console.log('');\n for (const item of arr) {\n console.log(`### ${item.itemLabel} (\\`${item.itemKey}\\`)`);\n console.log('');\n console.log(item.content);\n console.log('');\n }\n }\n}\n\ntype BundleItem = { section: string; itemKey: string; itemLabel: string; content: string };\ntype Bundle = { items: BundleItem[] };\n\nasync function handleImport(argv: string[], apiUrl: string, token: string): Promise<void> {\n const propertyId = getApplicationArg(argv);\n const file = getArgValue(argv, '--file');\n const sourceId = getArgValue(argv, '--source-id');\n\n if (!propertyId || !file) {\n console.error('Error: --application and --file are required.');\n process.exit(1);\n }\n\n let bundle: Bundle;\n try {\n bundle = JSON.parse(readFileSync(file, 'utf8')) as Bundle;\n } catch (err) {\n console.error(`Error parsing ${file}: ${(err as Error).message}`);\n process.exit(1);\n return;\n }\n\n if (!bundle.items || !Array.isArray(bundle.items)) {\n console.error('Error: bundle.json must have an \"items\" array.');\n process.exit(1);\n }\n\n let ok = 0;\n let fail = 0;\n for (const item of bundle.items) {\n if (!isSection(item.section)) {\n console.error(` ✗ [${item.section}] ${item.itemKey}: invalid section`);\n fail++;\n continue;\n }\n const body: Record<string, unknown> = {\n section: item.section,\n itemKey: item.itemKey,\n itemLabel: item.itemLabel,\n content: item.content,\n source: 'cli',\n };\n if (sourceId) body.sourceId = sourceId;\n\n const result = await apiRequest<{ ok: boolean; error?: string; data?: ContextItem }>(\n apiUrl,\n token,\n 'PUT',\n `/org/properties/${propertyId}/context/items`,\n body\n );\n\n if (result.ok) {\n console.log(` ✓ [${item.section}] ${item.itemKey} (v${result.data?.version ?? '?'})`);\n ok++;\n } else {\n console.error(` ✗ [${item.section}] ${item.itemKey}: ${result.error ?? 'Unknown error'}`);\n fail++;\n }\n }\n\n console.log(`\\nImported ${ok}/${ok + fail} items${fail ? ` (${fail} failed)` : ''}.`);\n if (fail > 0) process.exit(1);\n}\n\nfunction handleGuide(): void {\n try {\n const guide = readFileSync(GUIDE_PATH, 'utf8');\n process.stdout.write(guide);\n if (!guide.endsWith('\\n')) process.stdout.write('\\n');\n } catch (err) {\n console.error(`Error: could not read authoring guide at ${GUIDE_PATH}`);\n console.error((err as Error).message);\n process.exit(1);\n }\n}\n\nexport async function runPropertySkill(argv: string[], apiUrl: string, token: string): Promise<void> {\n const [action, ...rest] = argv;\n\n if (!action || action === 'help' || hasFlag(argv, '--help', '-h')) {\n printSkillHelp();\n return;\n }\n\n switch (action) {\n case 'guide':\n handleGuide();\n return;\n case 'list':\n await handleList(rest, apiUrl, token);\n break;\n case 'get':\n await handleGet(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 'history':\n await handleHistory(rest, apiUrl, token);\n break;\n case 'export':\n await handleExport(rest, apiUrl, token);\n break;\n case 'import':\n await handleImport(rest, apiUrl, token);\n break;\n default:\n console.error(`Unknown skill action: ${action}`);\n printSkillHelp();\n process.exit(1);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAMA,OAAOA,cAAa;;;ACGpB,SAAS,oBAAoB;AAC7B,SAAS,SAAS,YAAY;AAC9B,SAAS,qBAAqB;AAC9B,OAAO,aAAa;AAIpB,IAAM,OAAO,QAAQ,cAAc,YAAY,GAAG,CAAC;AACnD,IAAM,aAAa,KAAK,MAAM,yBAAyB;AAEvD,IAAM,WAAW;AAAA,EACf;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAC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