@markmdev/pebble 0.1.10 → 0.1.11
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/cli/index.js +40 -44
- package/dist/cli/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -3245,7 +3245,7 @@ function formatSummaryPretty(summaries, sectionHeader) {
|
|
|
3245
3245
|
return lines.join("\n");
|
|
3246
3246
|
}
|
|
3247
3247
|
function summaryCommand(program2) {
|
|
3248
|
-
program2.command("summary").description("Show epic summary with child completion status").option("--status <status>", "Filter epics by status
|
|
3248
|
+
program2.command("summary").description("Show epic summary with child completion status").option("--status <status>", "Filter epics by specific status").option("--limit <n>", "Max epics to return per section", "10").action(async (options) => {
|
|
3249
3249
|
const pretty = program2.opts().pretty ?? false;
|
|
3250
3250
|
try {
|
|
3251
3251
|
getOrCreatePebbleDir();
|
|
@@ -3273,60 +3273,56 @@ function summaryCommand(program2) {
|
|
|
3273
3273
|
return summary;
|
|
3274
3274
|
};
|
|
3275
3275
|
const limit = parseInt(options.limit, 10);
|
|
3276
|
-
if (options.
|
|
3277
|
-
const
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
);
|
|
3282
|
-
|
|
3283
|
-
(a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
|
|
3284
|
-
);
|
|
3285
|
-
closedEpics.sort(
|
|
3276
|
+
if (options.status !== void 0) {
|
|
3277
|
+
const status = options.status;
|
|
3278
|
+
if (!STATUSES.includes(status)) {
|
|
3279
|
+
throw new Error(`Invalid status: ${status}. Must be one of: ${STATUSES.join(", ")}`);
|
|
3280
|
+
}
|
|
3281
|
+
let epics = allEpics.filter((e) => e.status === status);
|
|
3282
|
+
epics.sort(
|
|
3286
3283
|
(a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
|
|
3287
3284
|
);
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
const
|
|
3285
|
+
if (limit > 0) {
|
|
3286
|
+
epics = epics.slice(0, limit);
|
|
3287
|
+
}
|
|
3288
|
+
const summaries = epics.map(buildSummary);
|
|
3292
3289
|
if (pretty) {
|
|
3293
|
-
|
|
3294
|
-
if (openSummaries.length > 0) {
|
|
3295
|
-
output.push(formatSummaryPretty(openSummaries, "Open Epics"));
|
|
3296
|
-
}
|
|
3297
|
-
if (closedSummaries.length > 0) {
|
|
3298
|
-
if (output.length > 0) output.push("");
|
|
3299
|
-
output.push(formatSummaryPretty(closedSummaries, "Recently Closed Epics (last 72h)"));
|
|
3300
|
-
}
|
|
3301
|
-
console.log(output.join("\n"));
|
|
3290
|
+
console.log(formatSummaryPretty(summaries, `${STATUS_LABELS[status]} Epics`));
|
|
3302
3291
|
} else {
|
|
3303
|
-
console.log(formatJson(
|
|
3292
|
+
console.log(formatJson(summaries));
|
|
3304
3293
|
}
|
|
3305
3294
|
return;
|
|
3306
3295
|
}
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
}
|
|
3314
|
-
epics = epics.filter((e) => e.status === status);
|
|
3315
|
-
sectionHeader = `${STATUS_LABELS[status]} Epics`;
|
|
3316
|
-
} else {
|
|
3317
|
-
epics = epics.filter((e) => e.status !== "closed");
|
|
3318
|
-
}
|
|
3319
|
-
epics.sort(
|
|
3296
|
+
const openEpics = allEpics.filter((e) => e.status !== "closed");
|
|
3297
|
+
const seventyTwoHoursAgo = Date.now() - 72 * 60 * 60 * 1e3;
|
|
3298
|
+
const closedEpics = allEpics.filter(
|
|
3299
|
+
(e) => e.status === "closed" && new Date(e.updatedAt).getTime() > seventyTwoHoursAgo
|
|
3300
|
+
);
|
|
3301
|
+
openEpics.sort(
|
|
3320
3302
|
(a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
|
|
3321
3303
|
);
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
const
|
|
3304
|
+
closedEpics.sort(
|
|
3305
|
+
(a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
|
|
3306
|
+
);
|
|
3307
|
+
const limitedOpen = limit > 0 ? openEpics.slice(0, limit) : openEpics;
|
|
3308
|
+
const limitedClosed = limit > 0 ? closedEpics.slice(0, limit) : closedEpics;
|
|
3309
|
+
const openSummaries = limitedOpen.map(buildSummary);
|
|
3310
|
+
const closedSummaries = limitedClosed.map(buildSummary);
|
|
3326
3311
|
if (pretty) {
|
|
3327
|
-
|
|
3312
|
+
const output = [];
|
|
3313
|
+
if (openSummaries.length > 0) {
|
|
3314
|
+
output.push(formatSummaryPretty(openSummaries, "Open Epics"));
|
|
3315
|
+
}
|
|
3316
|
+
if (closedSummaries.length > 0) {
|
|
3317
|
+
if (output.length > 0) output.push("");
|
|
3318
|
+
output.push(formatSummaryPretty(closedSummaries, "Recently Closed Epics (last 72h)"));
|
|
3319
|
+
}
|
|
3320
|
+
if (output.length === 0) {
|
|
3321
|
+
output.push("No epics found.");
|
|
3322
|
+
}
|
|
3323
|
+
console.log(output.join("\n"));
|
|
3328
3324
|
} else {
|
|
3329
|
-
console.log(formatJson(
|
|
3325
|
+
console.log(formatJson({ open: openSummaries, closed: closedSummaries }));
|
|
3330
3326
|
}
|
|
3331
3327
|
} catch (error) {
|
|
3332
3328
|
outputError(error, pretty);
|