@skillrecordings/cli 0.6.0 → 0.7.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/index.js +153 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -93178,6 +93178,135 @@ function registerReportCommand(front) {
|
|
|
93178
93178
|
).option("--json", "Output as JSON").action(generateReport);
|
|
93179
93179
|
}
|
|
93180
93180
|
|
|
93181
|
+
// src/commands/front/search.ts
|
|
93182
|
+
init_esm_shims();
|
|
93183
|
+
function getFrontClient7() {
|
|
93184
|
+
const apiToken = process.env.FRONT_API_TOKEN;
|
|
93185
|
+
if (!apiToken) {
|
|
93186
|
+
throw new Error("FRONT_API_TOKEN environment variable is required");
|
|
93187
|
+
}
|
|
93188
|
+
return createInstrumentedFrontClient({ apiToken });
|
|
93189
|
+
}
|
|
93190
|
+
function formatTimestamp2(ts) {
|
|
93191
|
+
return new Date(ts * 1e3).toLocaleString("en-US", {
|
|
93192
|
+
month: "short",
|
|
93193
|
+
day: "numeric",
|
|
93194
|
+
hour: "2-digit",
|
|
93195
|
+
minute: "2-digit"
|
|
93196
|
+
});
|
|
93197
|
+
}
|
|
93198
|
+
function truncate2(str2, len) {
|
|
93199
|
+
if (str2.length <= len) return str2;
|
|
93200
|
+
return str2.slice(0, len - 3) + "...";
|
|
93201
|
+
}
|
|
93202
|
+
function buildQuery(query, options) {
|
|
93203
|
+
const parts = [query];
|
|
93204
|
+
if (options.inbox) parts.push(`inbox:${options.inbox}`);
|
|
93205
|
+
if (options.tag) parts.push(`tag:${options.tag}`);
|
|
93206
|
+
if (options.assignee) parts.push(`assignee:${options.assignee}`);
|
|
93207
|
+
if (options.status) parts.push(`is:${options.status}`);
|
|
93208
|
+
if (options.from) parts.push(`from:${options.from}`);
|
|
93209
|
+
if (options.after) parts.push(`after:${options.after}`);
|
|
93210
|
+
if (options.before) parts.push(`before:${options.before}`);
|
|
93211
|
+
return parts.filter(Boolean).join(" ");
|
|
93212
|
+
}
|
|
93213
|
+
async function searchConversations(query, options) {
|
|
93214
|
+
try {
|
|
93215
|
+
const front = getFrontClient7();
|
|
93216
|
+
const fullQuery = buildQuery(query, options);
|
|
93217
|
+
const limit2 = parseInt(String(options.limit ?? "25"), 10);
|
|
93218
|
+
const resolvedLimit = Number.isFinite(limit2) && limit2 > 0 ? limit2 : void 0;
|
|
93219
|
+
const conversations = [];
|
|
93220
|
+
let nextUrl = `/conversations/search/${encodeURIComponent(fullQuery)}`;
|
|
93221
|
+
while (nextUrl) {
|
|
93222
|
+
const response = await front.raw.get(nextUrl);
|
|
93223
|
+
conversations.push(...response._results ?? []);
|
|
93224
|
+
if (!options.json) {
|
|
93225
|
+
process.stdout.write(`\r Searching... ${conversations.length} results`);
|
|
93226
|
+
}
|
|
93227
|
+
nextUrl = response._pagination?.next || null;
|
|
93228
|
+
if (resolvedLimit && conversations.length >= resolvedLimit) {
|
|
93229
|
+
conversations.splice(resolvedLimit);
|
|
93230
|
+
break;
|
|
93231
|
+
}
|
|
93232
|
+
}
|
|
93233
|
+
if (!options.json) {
|
|
93234
|
+
console.log("");
|
|
93235
|
+
}
|
|
93236
|
+
if (options.json) {
|
|
93237
|
+
console.log(
|
|
93238
|
+
JSON.stringify(
|
|
93239
|
+
hateoasWrap({
|
|
93240
|
+
type: "search-results",
|
|
93241
|
+
command: `skill front search ${JSON.stringify(fullQuery)} --json`,
|
|
93242
|
+
data: {
|
|
93243
|
+
query: fullQuery,
|
|
93244
|
+
total: conversations.length,
|
|
93245
|
+
conversations
|
|
93246
|
+
},
|
|
93247
|
+
links: conversationListLinks(
|
|
93248
|
+
conversations.map((c) => ({ id: c.id, subject: c.subject }))
|
|
93249
|
+
),
|
|
93250
|
+
actions: options.inbox ? conversationListActions(options.inbox) : []
|
|
93251
|
+
}),
|
|
93252
|
+
null,
|
|
93253
|
+
2
|
|
93254
|
+
)
|
|
93255
|
+
);
|
|
93256
|
+
return;
|
|
93257
|
+
}
|
|
93258
|
+
console.log(`
|
|
93259
|
+
\u{1F50D} Search: ${fullQuery}`);
|
|
93260
|
+
console.log(` ${conversations.length} results`);
|
|
93261
|
+
console.log("-".repeat(80));
|
|
93262
|
+
if (conversations.length === 0) {
|
|
93263
|
+
console.log(" (no conversations found)");
|
|
93264
|
+
console.log("");
|
|
93265
|
+
return;
|
|
93266
|
+
}
|
|
93267
|
+
for (const conv of conversations) {
|
|
93268
|
+
const statusIcon = conv.status === "archived" ? "\u{1F4E6}" : conv.status === "assigned" ? "\u{1F464}" : "\u2753";
|
|
93269
|
+
const time = formatTimestamp2(conv.created_at);
|
|
93270
|
+
const assignee = conv.assignee ? conv.assignee.email : "unassigned";
|
|
93271
|
+
const tags = conv.tags && conv.tags.length > 0 ? conv.tags.map((t2) => t2.name).join(", ") : "";
|
|
93272
|
+
console.log(
|
|
93273
|
+
`
|
|
93274
|
+
[${statusIcon}] ${truncate2(conv.subject || "(no subject)", 80)}`
|
|
93275
|
+
);
|
|
93276
|
+
console.log(` ${conv.id} ${assignee} ${time}`);
|
|
93277
|
+
if (tags) {
|
|
93278
|
+
console.log(` Tags: ${tags}`);
|
|
93279
|
+
}
|
|
93280
|
+
}
|
|
93281
|
+
console.log("");
|
|
93282
|
+
} catch (error) {
|
|
93283
|
+
if (options.json) {
|
|
93284
|
+
console.error(
|
|
93285
|
+
JSON.stringify({
|
|
93286
|
+
error: error instanceof Error ? error.message : "Unknown error"
|
|
93287
|
+
})
|
|
93288
|
+
);
|
|
93289
|
+
} else {
|
|
93290
|
+
console.error(
|
|
93291
|
+
"Error:",
|
|
93292
|
+
error instanceof Error ? error.message : "Unknown error"
|
|
93293
|
+
);
|
|
93294
|
+
}
|
|
93295
|
+
process.exit(1);
|
|
93296
|
+
}
|
|
93297
|
+
}
|
|
93298
|
+
function registerSearchCommand(frontCommand) {
|
|
93299
|
+
frontCommand.command("search").description(
|
|
93300
|
+
"Search conversations (text, subject, filters). See https://dev.frontapp.com/docs/search-1"
|
|
93301
|
+
).argument(
|
|
93302
|
+
"<query>",
|
|
93303
|
+
'Search query (text, "exact phrase", or filter syntax)'
|
|
93304
|
+
).option("--inbox <id>", "Filter by inbox ID (inb_xxx)").option("--tag <id>", "Filter by tag ID (tag_xxx)").option("--assignee <id>", "Filter by assignee (tea_xxx)").option(
|
|
93305
|
+
"--status <status>",
|
|
93306
|
+
"Filter by status (open, archived, assigned, unassigned, unreplied, snoozed, resolved)"
|
|
93307
|
+
).option("--from <email>", "Filter by sender email").option("--after <timestamp>", "Filter after Unix timestamp").option("--before <timestamp>", "Filter before Unix timestamp").option("--limit <n>", "Max results (default 25)", "25").option("--json", "Output as JSON").action(searchConversations);
|
|
93308
|
+
}
|
|
93309
|
+
|
|
93181
93310
|
// src/commands/front/tags.ts
|
|
93182
93311
|
init_esm_shims();
|
|
93183
93312
|
import { confirm as confirm3 } from "@inquirer/prompts";
|
|
@@ -93249,7 +93378,7 @@ async function createTagRaw(params) {
|
|
|
93249
93378
|
const front = createInstrumentedFrontClient({ apiToken });
|
|
93250
93379
|
await front.raw.post("/tags", body);
|
|
93251
93380
|
}
|
|
93252
|
-
function
|
|
93381
|
+
function truncate3(str2, len) {
|
|
93253
93382
|
if (str2.length <= len) return str2;
|
|
93254
93383
|
return str2.slice(0, len - 3) + "...";
|
|
93255
93384
|
}
|
|
@@ -93342,7 +93471,7 @@ ${header} (${filteredTags.length}):`);
|
|
|
93342
93471
|
const highlight = tag.highlight || "-";
|
|
93343
93472
|
const countStr = tag.conversation_count === 0 ? "0 \u26A0\uFE0F" : tag.conversation_count.toString();
|
|
93344
93473
|
console.log(
|
|
93345
|
-
`${
|
|
93474
|
+
`${truncate3(tag.id, 20).padEnd(20)} ${truncate3(tag.name, 30).padEnd(30)} ${highlight.padEnd(10)} ${countStr.padEnd(8)}`
|
|
93346
93475
|
);
|
|
93347
93476
|
}
|
|
93348
93477
|
console.log("");
|
|
@@ -93735,7 +93864,7 @@ function registerTagCommands(frontCommand) {
|
|
|
93735
93864
|
|
|
93736
93865
|
// src/commands/front/triage.ts
|
|
93737
93866
|
init_esm_shims();
|
|
93738
|
-
function
|
|
93867
|
+
function getFrontClient8() {
|
|
93739
93868
|
const apiToken = process.env.FRONT_API_TOKEN;
|
|
93740
93869
|
if (!apiToken) {
|
|
93741
93870
|
throw new Error("FRONT_API_TOKEN environment variable is required");
|
|
@@ -93774,7 +93903,7 @@ function categorizeConversation(conversation) {
|
|
|
93774
93903
|
}
|
|
93775
93904
|
return { category: "actionable", reason: "Real support issue" };
|
|
93776
93905
|
}
|
|
93777
|
-
function
|
|
93906
|
+
function formatTimestamp3(ts) {
|
|
93778
93907
|
return new Date(ts * 1e3).toLocaleString("en-US", {
|
|
93779
93908
|
month: "short",
|
|
93780
93909
|
day: "numeric",
|
|
@@ -93790,7 +93919,7 @@ async function triageConversations(options) {
|
|
|
93790
93919
|
json = false
|
|
93791
93920
|
} = options;
|
|
93792
93921
|
try {
|
|
93793
|
-
const front =
|
|
93922
|
+
const front = getFrontClient8();
|
|
93794
93923
|
if (!json) {
|
|
93795
93924
|
console.log(`
|
|
93796
93925
|
Fetching ${status} conversations from inbox ${inbox}...`);
|
|
@@ -93871,7 +94000,7 @@ Fetching ${status} conversations from inbox ${inbox}...`);
|
|
|
93871
94000
|
if (byCategory.actionable.length > 0) {
|
|
93872
94001
|
console.log(`\u2705 ACTIONABLE (${byCategory.actionable.length}):`);
|
|
93873
94002
|
for (const r of byCategory.actionable.sort((a, b) => b.created_at - a.created_at).slice(0, 10)) {
|
|
93874
|
-
console.log(` ${r.id} - ${
|
|
94003
|
+
console.log(` ${r.id} - ${formatTimestamp3(r.created_at)}`);
|
|
93875
94004
|
console.log(` From: ${r.senderEmail}`);
|
|
93876
94005
|
console.log(` Subject: ${r.subject}`);
|
|
93877
94006
|
console.log(` \u2192 ${r.reason}`);
|
|
@@ -93957,7 +94086,7 @@ function registerTriageCommand(front) {
|
|
|
93957
94086
|
}
|
|
93958
94087
|
|
|
93959
94088
|
// src/commands/front/index.ts
|
|
93960
|
-
function
|
|
94089
|
+
function getFrontClient9() {
|
|
93961
94090
|
const apiToken = process.env.FRONT_API_TOKEN;
|
|
93962
94091
|
if (!apiToken) {
|
|
93963
94092
|
throw new Error("FRONT_API_TOKEN environment variable is required");
|
|
@@ -93971,7 +94100,7 @@ function getFrontSdkClient2() {
|
|
|
93971
94100
|
}
|
|
93972
94101
|
return createInstrumentedFrontClient({ apiToken });
|
|
93973
94102
|
}
|
|
93974
|
-
function
|
|
94103
|
+
function formatTimestamp4(ts) {
|
|
93975
94104
|
return new Date(ts * 1e3).toLocaleString("en-US", {
|
|
93976
94105
|
month: "short",
|
|
93977
94106
|
day: "numeric",
|
|
@@ -93979,7 +94108,7 @@ function formatTimestamp3(ts) {
|
|
|
93979
94108
|
minute: "2-digit"
|
|
93980
94109
|
});
|
|
93981
94110
|
}
|
|
93982
|
-
function
|
|
94111
|
+
function truncate4(str2, len) {
|
|
93983
94112
|
if (str2.length <= len) return str2;
|
|
93984
94113
|
return str2.slice(0, len - 3) + "...";
|
|
93985
94114
|
}
|
|
@@ -93988,7 +94117,7 @@ function normalizeId6(idOrUrl) {
|
|
|
93988
94117
|
}
|
|
93989
94118
|
async function getMessage(id, options) {
|
|
93990
94119
|
try {
|
|
93991
|
-
const front =
|
|
94120
|
+
const front = getFrontClient9();
|
|
93992
94121
|
const message = await front.messages.get(normalizeId6(id));
|
|
93993
94122
|
if (options.json) {
|
|
93994
94123
|
console.log(
|
|
@@ -94009,7 +94138,7 @@ async function getMessage(id, options) {
|
|
|
94009
94138
|
console.log(` ID: ${message.id}`);
|
|
94010
94139
|
console.log(` Type: ${message.type}`);
|
|
94011
94140
|
console.log(` Subject: ${message.subject || "(none)"}`);
|
|
94012
|
-
console.log(` Created: ${
|
|
94141
|
+
console.log(` Created: ${formatTimestamp4(message.created_at)}`);
|
|
94013
94142
|
if (message.author) {
|
|
94014
94143
|
console.log(` Author: ${message.author.email || message.author.id}`);
|
|
94015
94144
|
}
|
|
@@ -94022,7 +94151,7 @@ async function getMessage(id, options) {
|
|
|
94022
94151
|
console.log(
|
|
94023
94152
|
` Length: ${message.body.length} chars (HTML), ${textBody.length} chars (text)`
|
|
94024
94153
|
);
|
|
94025
|
-
console.log(` Preview: ${
|
|
94154
|
+
console.log(` Preview: ${truncate4(textBody, 500)}`);
|
|
94026
94155
|
if (message.attachments && message.attachments.length > 0) {
|
|
94027
94156
|
console.log(`
|
|
94028
94157
|
\u{1F4CE} Attachments: ${message.attachments.length}`);
|
|
@@ -94049,7 +94178,7 @@ async function getMessage(id, options) {
|
|
|
94049
94178
|
}
|
|
94050
94179
|
async function getConversation2(id, options) {
|
|
94051
94180
|
try {
|
|
94052
|
-
const front =
|
|
94181
|
+
const front = getFrontClient9();
|
|
94053
94182
|
const conversation = await front.conversations.get(normalizeId6(id));
|
|
94054
94183
|
let messages;
|
|
94055
94184
|
if (options.messages) {
|
|
@@ -94079,7 +94208,7 @@ async function getConversation2(id, options) {
|
|
|
94079
94208
|
console.log(` ID: ${conversation.id}`);
|
|
94080
94209
|
console.log(` Subject: ${conversation.subject || "(none)"}`);
|
|
94081
94210
|
console.log(` Status: ${conversation.status}`);
|
|
94082
|
-
console.log(` Created: ${
|
|
94211
|
+
console.log(` Created: ${formatTimestamp4(conversation.created_at)}`);
|
|
94083
94212
|
if (conversation.recipient) {
|
|
94084
94213
|
console.log(` Recipient: ${conversation.recipient.handle}`);
|
|
94085
94214
|
}
|
|
@@ -94098,11 +94227,11 @@ async function getConversation2(id, options) {
|
|
|
94098
94227
|
for (const msg of messages) {
|
|
94099
94228
|
const direction = msg.is_inbound ? "\u2190 IN" : "\u2192 OUT";
|
|
94100
94229
|
const author = msg.author?.email || "unknown";
|
|
94101
|
-
const time =
|
|
94230
|
+
const time = formatTimestamp4(msg.created_at);
|
|
94102
94231
|
const textBody = msg.text || msg.body.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim();
|
|
94103
94232
|
console.log(`
|
|
94104
94233
|
[${direction}] ${time} - ${author}`);
|
|
94105
|
-
console.log(` ${
|
|
94234
|
+
console.log(` ${truncate4(textBody, 200)}`);
|
|
94106
94235
|
}
|
|
94107
94236
|
} else if (!options.messages) {
|
|
94108
94237
|
console.log("\n (use --messages to see message history)");
|
|
@@ -94241,6 +94370,7 @@ function registerFrontCommands(program3) {
|
|
|
94241
94370
|
registerAssignCommand(front);
|
|
94242
94371
|
registerConversationTagCommands(front);
|
|
94243
94372
|
registerReplyCommand(front);
|
|
94373
|
+
registerSearchCommand(front);
|
|
94244
94374
|
registerApiCommand(front);
|
|
94245
94375
|
}
|
|
94246
94376
|
|
|
@@ -94768,7 +94898,7 @@ var InngestClient = class {
|
|
|
94768
94898
|
};
|
|
94769
94899
|
|
|
94770
94900
|
// src/commands/inngest/events.ts
|
|
94771
|
-
function
|
|
94901
|
+
function formatTimestamp5(iso) {
|
|
94772
94902
|
const date = new Date(iso);
|
|
94773
94903
|
return date.toLocaleString("en-US", {
|
|
94774
94904
|
month: "short",
|
|
@@ -94792,7 +94922,7 @@ function printEventsTable(events) {
|
|
|
94792
94922
|
console.log("-".repeat(86));
|
|
94793
94923
|
for (const event of events) {
|
|
94794
94924
|
console.log(
|
|
94795
|
-
pad(event.internal_id, 24) + " " + pad(event.name, 40) + " " + pad(
|
|
94925
|
+
pad(event.internal_id, 24) + " " + pad(event.name, 40) + " " + pad(formatTimestamp5(event.received_at), 20)
|
|
94796
94926
|
);
|
|
94797
94927
|
}
|
|
94798
94928
|
console.log("");
|
|
@@ -94808,7 +94938,7 @@ function printRunsTable(runs) {
|
|
|
94808
94938
|
console.log("-".repeat(94));
|
|
94809
94939
|
for (const run3 of runs) {
|
|
94810
94940
|
console.log(
|
|
94811
|
-
pad(run3.run_id, 30) + " " + pad(run3.function_id, 30) + " " + pad(run3.status, 12) + " " + pad(
|
|
94941
|
+
pad(run3.run_id, 30) + " " + pad(run3.function_id, 30) + " " + pad(run3.status, 12) + " " + pad(formatTimestamp5(run3.run_started_at), 20)
|
|
94812
94942
|
);
|
|
94813
94943
|
}
|
|
94814
94944
|
console.log("");
|
|
@@ -94871,7 +95001,7 @@ async function getEvent(id, options) {
|
|
|
94871
95001
|
console.log("\n\u{1F4CB} Event Details:");
|
|
94872
95002
|
console.log(` ID: ${event.internal_id}`);
|
|
94873
95003
|
console.log(` Name: ${event.name}`);
|
|
94874
|
-
console.log(` Received: ${
|
|
95004
|
+
console.log(` Received: ${formatTimestamp5(event.received_at)}`);
|
|
94875
95005
|
console.log(
|
|
94876
95006
|
` Data: ${event.data ? JSON.stringify(event.data, null, 2) : "(null)"}`
|
|
94877
95007
|
);
|
|
@@ -112423,7 +112553,7 @@ function formatDate3(date) {
|
|
|
112423
112553
|
minute: "2-digit"
|
|
112424
112554
|
});
|
|
112425
112555
|
}
|
|
112426
|
-
function
|
|
112556
|
+
function truncate5(str2, len) {
|
|
112427
112557
|
if (!str2) return "";
|
|
112428
112558
|
if (str2.length <= len) return str2;
|
|
112429
112559
|
return str2.slice(0, len - 3) + "...";
|
|
@@ -112633,7 +112763,7 @@ ${ratingIcon} [${formatDate3(r.createdAt)}] ${r.appSlug}`);
|
|
|
112633
112763
|
console.log(` Customer: ${r.customerDisplay}`);
|
|
112634
112764
|
console.log(` Category: ${r.category}`);
|
|
112635
112765
|
console.log(
|
|
112636
|
-
` Response: ${
|
|
112766
|
+
` Response: ${truncate5(r.response.replace(/\n/g, " "), 200)}`
|
|
112637
112767
|
);
|
|
112638
112768
|
console.log(` ID: ${r.actionId}`);
|
|
112639
112769
|
if (r.rating) {
|
|
@@ -112792,7 +112922,7 @@ async function getResponse(actionId, options) {
|
|
|
112792
112922
|
const time = new Date(msg.createdAt * 1e3).toLocaleString();
|
|
112793
112923
|
console.log(`
|
|
112794
112924
|
[${dir}] ${time} - ${msg.author ?? "unknown"}`);
|
|
112795
|
-
console.log(
|
|
112925
|
+
console.log(truncate5(msg.body, 500));
|
|
112796
112926
|
}
|
|
112797
112927
|
}
|
|
112798
112928
|
console.log("");
|