@mediamonks/canopy-cli 0.7.7 → 0.7.9
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/{db-D3RKaLVU.mjs → db-8Etjmzxh.mjs} +2 -2
- package/dist/{deploy-ClioT9ZC.mjs → deploy-y75cgauK.mjs} +2 -2
- package/dist/dev-BYxSHUH6.mjs +2 -0
- package/dist/{dev-BbAVZcAR.mjs → dev-DtoZrexp.mjs} +63 -8
- package/dist/dev-worker-BZgtEM9V.mjs +313 -0
- package/dist/docs/cli-dev.md +19 -0
- package/dist/docs/cli-feedback.md +38 -14
- package/dist/docs/dev.md +19 -0
- package/dist/docs/overview-how-it-works.md +2 -1
- package/dist/docs/platform-client-access.md +2 -1
- package/dist/docs/platform-feedback.md +46 -11
- package/dist/docs/platform-members-and-access.md +2 -2
- package/dist/docs/platform-project-data.md +19 -9
- package/dist/{docs-DOiL2Sw-.mjs → docs-VmcoH1An.mjs} +2 -2
- package/dist/{egress-BkkG9Jzs.mjs → egress-CN_axsAN.mjs} +1 -1
- package/dist/feedback-DUuWXS_D.mjs +390 -0
- package/dist/index.mjs +24 -24
- package/dist/{local-BHxSZwUT.mjs → local-C5AhA4GM.mjs} +160 -6
- package/dist/{login-C1x1l3qg.mjs → login-D7dI8D9N.mjs} +28 -12
- package/dist/{logs-DuzM-_Rn.mjs → logs-DNiZquki.mjs} +1 -1
- package/dist/{migrations-DpWHuqkQ.mjs → migrations-C-5x6SYf.mjs} +1 -1
- package/dist/{open-CLSh6oez.mjs → open-DRPp4QJg.mjs} +1 -1
- package/dist/{package-BNiOibhj.mjs → package-CGrKr6IT.mjs} +1 -1
- package/dist/{projects-C9TBoiW7.mjs → projects-C6JQjVqg.mjs} +1 -1
- package/dist/{skill-DRTg-mJR.mjs → skill-CZP1AqQX.mjs} +2 -2
- package/dist/{staging-95xeXyZN.mjs → staging-Bw1D_J8M.mjs} +1 -1
- package/dist/templates/worker/.dev.vars.example +9 -0
- package/dist/templates/worker/AGENTS.md +7 -1
- package/dist/templates/worker/README.md +4 -1
- package/dist/templates/worker/_gitignore +1 -0
- package/dist/{token-BjlqT2Xj.mjs → token-D7zrIF8G.mjs} +1 -1
- package/dist/{ui-CpdtK7mt.mjs → ui-2mrJcjYC.mjs} +30 -1
- package/dist/{upgrade-BDaM4M6Y.mjs → upgrade-CmhSO_r6.mjs} +2 -2
- package/dist/{usage-wpew0a2M.mjs → usage-CX1Izj_l.mjs} +1 -1
- package/package.json +1 -1
- package/dist/dev-D6Sy15Wv.mjs +0 -2
- package/dist/feedback-BZG8E8zG.mjs +0 -258
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
import { t as version } from "./package-BNiOibhj.mjs";
|
|
2
|
-
import { a as projectDirArgs, c as resolveProject, n as siteConfig, u as tryReadCanopyJson } from "./site-BUlQR117.mjs";
|
|
3
|
-
import { c as apiRequest, n as reportErrors } from "./ui-CpdtK7mt.mjs";
|
|
4
|
-
import { defineCommand } from "citty";
|
|
5
|
-
//#region src/feedback.ts
|
|
6
|
-
/**
|
|
7
|
-
* canopy feedback — the ticket-lite feedback system (docs/19, docs topic
|
|
8
|
-
* `platform-feedback`). Two jobs:
|
|
9
|
-
*
|
|
10
|
-
* - Work a project's inbox: `list`, `show`, `comment`, `status` — the loop an
|
|
11
|
-
* agent runs over items a human marked `accepted`.
|
|
12
|
-
* - File reports: `report` sends a bug/feedback item. With no `--project` it
|
|
13
|
-
* lands on the **platform inbox** (canopy itself) — the right target when a
|
|
14
|
-
* canopy command misbehaves while you're building something else.
|
|
15
|
-
*/
|
|
16
|
-
const STATUSES = [
|
|
17
|
-
"new",
|
|
18
|
-
"accepted",
|
|
19
|
-
"in_progress",
|
|
20
|
-
"resolved",
|
|
21
|
-
"declined"
|
|
22
|
-
];
|
|
23
|
-
const KINDS = [
|
|
24
|
-
"bug",
|
|
25
|
-
"feedback",
|
|
26
|
-
"docs"
|
|
27
|
-
];
|
|
28
|
-
const jsonArg = { json: {
|
|
29
|
-
type: "boolean",
|
|
30
|
-
description: "Machine-readable JSON output"
|
|
31
|
-
} };
|
|
32
|
-
function firstLine(body) {
|
|
33
|
-
const line = body.split("\n")[0] ?? "";
|
|
34
|
-
return line.length > 72 ? `${line.slice(0, 71)}…` : line;
|
|
35
|
-
}
|
|
36
|
-
function printItems(items) {
|
|
37
|
-
if (items.length === 0) {
|
|
38
|
-
console.log("No matching feedback items.");
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
for (const item of items) {
|
|
42
|
-
const comments = item.comment_count ? ` 💬${item.comment_count}` : "";
|
|
43
|
-
console.log(`${item.id} ${item.status} ${item.kind} ${firstLine(item.body)}${comments}`);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
const feedbackCommand = defineCommand({
|
|
47
|
-
meta: {
|
|
48
|
-
name: "feedback",
|
|
49
|
-
description: "Work a project's feedback inbox, or file a report (see docs: platform-feedback)"
|
|
50
|
-
},
|
|
51
|
-
subCommands: {
|
|
52
|
-
list: defineCommand({
|
|
53
|
-
meta: {
|
|
54
|
-
name: "list",
|
|
55
|
-
description: "List the project's feedback inbox (members only)"
|
|
56
|
-
},
|
|
57
|
-
args: {
|
|
58
|
-
...projectDirArgs,
|
|
59
|
-
...jsonArg,
|
|
60
|
-
status: {
|
|
61
|
-
type: "string",
|
|
62
|
-
description: `Filter: ${STATUSES.join(" | ")}`
|
|
63
|
-
},
|
|
64
|
-
kind: {
|
|
65
|
-
type: "string",
|
|
66
|
-
description: `Filter: ${KINDS.join(" | ")}`
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
run: reportErrors("feedback list", async ({ args }) => {
|
|
70
|
-
const { slug } = resolveProject(args);
|
|
71
|
-
const params = new URLSearchParams();
|
|
72
|
-
if (args.status) params.set("status", args.status);
|
|
73
|
-
if (args.kind) params.set("kind", args.kind);
|
|
74
|
-
const { items } = await apiRequest("GET", `/projects/${slug}/feedback${params.size > 0 ? `?${params}` : ""}`);
|
|
75
|
-
if (args.json) console.log(JSON.stringify(items, null, 2));
|
|
76
|
-
else printItems(items);
|
|
77
|
-
})
|
|
78
|
-
}),
|
|
79
|
-
show: defineCommand({
|
|
80
|
-
meta: {
|
|
81
|
-
name: "show",
|
|
82
|
-
description: "Full detail of one item: body, context, comment trail"
|
|
83
|
-
},
|
|
84
|
-
args: {
|
|
85
|
-
id: {
|
|
86
|
-
type: "positional",
|
|
87
|
-
description: "Item id (from `canopy feedback list`)",
|
|
88
|
-
required: true
|
|
89
|
-
},
|
|
90
|
-
...projectDirArgs,
|
|
91
|
-
...jsonArg
|
|
92
|
-
},
|
|
93
|
-
run: reportErrors("feedback show", async ({ args }) => {
|
|
94
|
-
const { slug } = resolveProject(args);
|
|
95
|
-
const detail = await apiRequest("GET", `/projects/${slug}/feedback/${encodeURIComponent(args.id)}`);
|
|
96
|
-
if (args.json) {
|
|
97
|
-
console.log(JSON.stringify(detail, null, 2));
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
const { item, comments } = detail;
|
|
101
|
-
console.log(`${item.kind} · ${item.status} · via ${item.source} · ${item.created_at}`);
|
|
102
|
-
console.log(`reported by ${item.reporter_name || item.reporter_email || "unknown"}` + (item.deployment_id ? ` on ${item.deployment_id}` : "") + (item.channel === "staging" ? " (staging)" : ""));
|
|
103
|
-
console.log(`\n${item.body}\n`);
|
|
104
|
-
if (item.context) {
|
|
105
|
-
console.log("context:");
|
|
106
|
-
try {
|
|
107
|
-
console.log(JSON.stringify(JSON.parse(item.context), null, 2));
|
|
108
|
-
} catch {
|
|
109
|
-
console.log(item.context);
|
|
110
|
-
}
|
|
111
|
-
console.log("");
|
|
112
|
-
}
|
|
113
|
-
for (const entry of comments) {
|
|
114
|
-
const author = entry.author_name || entry.author_email || "unknown";
|
|
115
|
-
const move = entry.status_to ? ` [${entry.status_from} → ${entry.status_to}]` : "";
|
|
116
|
-
console.log(`--- ${author} · ${entry.created_at}${move}`);
|
|
117
|
-
if (entry.body) console.log(entry.body);
|
|
118
|
-
}
|
|
119
|
-
})
|
|
120
|
-
}),
|
|
121
|
-
comment: defineCommand({
|
|
122
|
-
meta: {
|
|
123
|
-
name: "comment",
|
|
124
|
-
description: "Append a comment to an item (e.g. debug findings)"
|
|
125
|
-
},
|
|
126
|
-
args: {
|
|
127
|
-
id: {
|
|
128
|
-
type: "positional",
|
|
129
|
-
description: "Item id",
|
|
130
|
-
required: true
|
|
131
|
-
},
|
|
132
|
-
text: {
|
|
133
|
-
type: "positional",
|
|
134
|
-
description: "Comment text",
|
|
135
|
-
required: true
|
|
136
|
-
},
|
|
137
|
-
...projectDirArgs
|
|
138
|
-
},
|
|
139
|
-
run: reportErrors("feedback comment", async ({ args }) => {
|
|
140
|
-
const { slug } = resolveProject(args);
|
|
141
|
-
await apiRequest("POST", `/projects/${slug}/feedback/${encodeURIComponent(args.id)}/comments`, { body: args.text });
|
|
142
|
-
console.log("Comment added.");
|
|
143
|
-
})
|
|
144
|
-
}),
|
|
145
|
-
status: defineCommand({
|
|
146
|
-
meta: {
|
|
147
|
-
name: "status",
|
|
148
|
-
description: "Move an item to a new status (members only)"
|
|
149
|
-
},
|
|
150
|
-
args: {
|
|
151
|
-
id: {
|
|
152
|
-
type: "positional",
|
|
153
|
-
description: "Item id",
|
|
154
|
-
required: true
|
|
155
|
-
},
|
|
156
|
-
to: {
|
|
157
|
-
type: "positional",
|
|
158
|
-
description: STATUSES.join(" | "),
|
|
159
|
-
required: true
|
|
160
|
-
},
|
|
161
|
-
comment: {
|
|
162
|
-
type: "string",
|
|
163
|
-
description: "Optional note recorded with the change"
|
|
164
|
-
},
|
|
165
|
-
...projectDirArgs
|
|
166
|
-
},
|
|
167
|
-
run: reportErrors("feedback status", async ({ args }) => {
|
|
168
|
-
const { slug } = resolveProject(args);
|
|
169
|
-
await apiRequest("POST", `/projects/${slug}/feedback/${encodeURIComponent(args.id)}/status`, {
|
|
170
|
-
status: args.to,
|
|
171
|
-
...args.comment ? { comment: args.comment } : {}
|
|
172
|
-
});
|
|
173
|
-
console.log(`Marked ${args.id} as ${args.to}.`);
|
|
174
|
-
})
|
|
175
|
-
}),
|
|
176
|
-
mine: defineCommand({
|
|
177
|
-
meta: {
|
|
178
|
-
name: "mine",
|
|
179
|
-
description: "Your own reports across all projects"
|
|
180
|
-
},
|
|
181
|
-
args: {
|
|
182
|
-
...jsonArg,
|
|
183
|
-
project: {
|
|
184
|
-
type: "string",
|
|
185
|
-
description: "Only reports on this project slug"
|
|
186
|
-
}
|
|
187
|
-
},
|
|
188
|
-
run: reportErrors("feedback mine", async ({ args }) => {
|
|
189
|
-
const { items } = await apiRequest("GET", `/feedback/mine${args.project ? `?project=${encodeURIComponent(args.project)}` : ""}`);
|
|
190
|
-
if (args.json) {
|
|
191
|
-
console.log(JSON.stringify(items, null, 2));
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
if (items.length === 0) {
|
|
195
|
-
console.log("You haven't filed any reports.");
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
for (const item of items) console.log(`${item.id} ${item.status} ${item.kind} [${item.project_slug}] ${firstLine(item.body)}`);
|
|
199
|
-
})
|
|
200
|
-
}),
|
|
201
|
-
report: defineCommand({
|
|
202
|
-
meta: {
|
|
203
|
-
name: "report",
|
|
204
|
-
description: "File a report. Default target is the platform inbox (canopy itself); use --project for a specific project"
|
|
205
|
-
},
|
|
206
|
-
args: {
|
|
207
|
-
text: {
|
|
208
|
-
type: "positional",
|
|
209
|
-
description: "What happened / what you suggest",
|
|
210
|
-
required: true
|
|
211
|
-
},
|
|
212
|
-
kind: {
|
|
213
|
-
type: "string",
|
|
214
|
-
description: "bug | feedback (default: bug)"
|
|
215
|
-
},
|
|
216
|
-
project: {
|
|
217
|
-
type: "string",
|
|
218
|
-
description: "Project slug to file against (default: the platform inbox)"
|
|
219
|
-
},
|
|
220
|
-
command: {
|
|
221
|
-
type: "string",
|
|
222
|
-
description: "The canopy command that failed (goes in context)"
|
|
223
|
-
},
|
|
224
|
-
error: {
|
|
225
|
-
type: "string",
|
|
226
|
-
description: "The error output you saw (goes in context)"
|
|
227
|
-
}
|
|
228
|
-
},
|
|
229
|
-
run: reportErrors("feedback report", async ({ args }) => {
|
|
230
|
-
const kind = args.kind ?? "bug";
|
|
231
|
-
if (kind !== "bug" && kind !== "feedback") {
|
|
232
|
-
console.error(`--kind must be bug or feedback (got "${kind}")`);
|
|
233
|
-
process.exit(1);
|
|
234
|
-
}
|
|
235
|
-
const context = {
|
|
236
|
-
cli_version: version,
|
|
237
|
-
site: siteConfig().profileId ?? siteConfig().apiUrl,
|
|
238
|
-
platform: `${process.platform} node ${process.versions.node}`
|
|
239
|
-
};
|
|
240
|
-
const workingOn = tryReadCanopyJson(".")?.slug;
|
|
241
|
-
if (workingOn) context["working_on"] = workingOn;
|
|
242
|
-
if (args.command) context["command"] = args.command;
|
|
243
|
-
if (args.error) context["error"] = args.error;
|
|
244
|
-
const { item } = await apiRequest("POST", "/feedback", {
|
|
245
|
-
kind,
|
|
246
|
-
body: args.text,
|
|
247
|
-
source: "cli",
|
|
248
|
-
...args.project ? { project: args.project } : {},
|
|
249
|
-
context
|
|
250
|
-
});
|
|
251
|
-
console.log(`Filed ${kind} ${item.id} on ${item.project}.`);
|
|
252
|
-
console.log(`Follow it with \`canopy feedback mine\` or on the dashboard's Reports page.`);
|
|
253
|
-
})
|
|
254
|
-
})
|
|
255
|
-
}
|
|
256
|
-
});
|
|
257
|
-
//#endregion
|
|
258
|
-
export { feedbackCommand };
|