@masslessai/push-todo 3.10.3 → 3.10.4
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/lib/cli.js +2 -1
- package/lib/utils/format.js +15 -3
- package/package.json +1 -1
package/lib/cli.js
CHANGED
|
@@ -393,7 +393,8 @@ export async function run(argv) {
|
|
|
393
393
|
process.exit(1);
|
|
394
394
|
}
|
|
395
395
|
|
|
396
|
-
const
|
|
396
|
+
const raw = task.screenshotAttachmentsJson || task.screenshotAttachments || task.screenshot_attachments;
|
|
397
|
+
const screenshots = !raw ? [] : Array.isArray(raw) ? raw : (() => { try { return JSON.parse(raw); } catch { return []; } })();
|
|
397
398
|
if (screenshots.length === 0) {
|
|
398
399
|
console.error(red(`Task #${displayNumber} has no screenshot attachments`));
|
|
399
400
|
process.exit(1);
|
package/lib/utils/format.js
CHANGED
|
@@ -6,6 +6,18 @@
|
|
|
6
6
|
|
|
7
7
|
import { bold, dim, green, yellow, red, cyan, muted, symbols } from './colors.js';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Parse a JSON string field into an array. Handles strings, arrays, null/undefined.
|
|
11
|
+
*/
|
|
12
|
+
function parseJsonField(value) {
|
|
13
|
+
if (!value) return [];
|
|
14
|
+
if (Array.isArray(value)) return value;
|
|
15
|
+
if (typeof value === 'string') {
|
|
16
|
+
try { return JSON.parse(value); } catch { return []; }
|
|
17
|
+
}
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
|
|
9
21
|
/**
|
|
10
22
|
* Format a duration in seconds to human-readable string.
|
|
11
23
|
*
|
|
@@ -85,9 +97,9 @@ export function formatTaskForDisplay(task) {
|
|
|
85
97
|
lines.push(task.content || task.normalizedContent || 'No content');
|
|
86
98
|
lines.push('');
|
|
87
99
|
|
|
88
|
-
// Attachments
|
|
89
|
-
const screenshots = task.
|
|
90
|
-
const links = task.
|
|
100
|
+
// Attachments — API returns JSON strings (screenshotAttachmentsJson, linkAttachmentsJson)
|
|
101
|
+
const screenshots = parseJsonField(task.screenshotAttachmentsJson || task.screenshotAttachments || task.screenshot_attachments);
|
|
102
|
+
const links = parseJsonField(task.linkAttachmentsJson || task.linkAttachments || task.link_attachments);
|
|
91
103
|
|
|
92
104
|
if (screenshots.length > 0 || links.length > 0) {
|
|
93
105
|
lines.push('### Attachments');
|