@nathanvale/chatline 0.0.1 → 0.0.2-next.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/CHANGELOG.md +6 -0
- package/dist/bin/index.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/cli/commands/clean.d.ts +0 -17
- package/dist/cli/commands/clean.d.ts.map +0 -1
- package/dist/cli/commands/clean.js +0 -142
- package/dist/cli/commands/clean.js.map +0 -1
- package/dist/cli/commands/doctor.d.ts +0 -17
- package/dist/cli/commands/doctor.d.ts.map +0 -1
- package/dist/cli/commands/doctor.js +0 -202
- package/dist/cli/commands/doctor.js.map +0 -1
- package/dist/cli/commands/enrich-ai.d.ts +0 -17
- package/dist/cli/commands/enrich-ai.d.ts.map +0 -1
- package/dist/cli/commands/enrich-ai.js +0 -371
- package/dist/cli/commands/enrich-ai.js.map +0 -1
- package/dist/cli/commands/index.d.ts +0 -16
- package/dist/cli/commands/index.d.ts.map +0 -1
- package/dist/cli/commands/index.js +0 -16
- package/dist/cli/commands/index.js.map +0 -1
- package/dist/cli/commands/ingest-csv.d.ts +0 -17
- package/dist/cli/commands/ingest-csv.d.ts.map +0 -1
- package/dist/cli/commands/ingest-csv.js +0 -138
- package/dist/cli/commands/ingest-csv.js.map +0 -1
- package/dist/cli/commands/ingest-db.d.ts +0 -17
- package/dist/cli/commands/ingest-db.d.ts.map +0 -1
- package/dist/cli/commands/ingest-db.js +0 -159
- package/dist/cli/commands/ingest-db.js.map +0 -1
- package/dist/cli/commands/init.d.ts +0 -17
- package/dist/cli/commands/init.d.ts.map +0 -1
- package/dist/cli/commands/init.js +0 -110
- package/dist/cli/commands/init.js.map +0 -1
- package/dist/cli/commands/normalize-link.d.ts +0 -16
- package/dist/cli/commands/normalize-link.d.ts.map +0 -1
- package/dist/cli/commands/normalize-link.js +0 -144
- package/dist/cli/commands/normalize-link.js.map +0 -1
- package/dist/cli/commands/render-markdown.d.ts +0 -17
- package/dist/cli/commands/render-markdown.d.ts.map +0 -1
- package/dist/cli/commands/render-markdown.js +0 -218
- package/dist/cli/commands/render-markdown.js.map +0 -1
- package/dist/cli/commands/stats.d.ts +0 -17
- package/dist/cli/commands/stats.d.ts.map +0 -1
- package/dist/cli/commands/stats.js +0 -175
- package/dist/cli/commands/stats.js.map +0 -1
- package/dist/cli/commands/validate.d.ts +0 -17
- package/dist/cli/commands/validate.d.ts.map +0 -1
- package/dist/cli/commands/validate.js +0 -152
- package/dist/cli/commands/validate.js.map +0 -1
- package/dist/cli/index.d.ts +0 -13
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/index.js +0 -121
- package/dist/cli/index.js.map +0 -1
- package/dist/cli/types.d.ts +0 -93
- package/dist/cli/types.d.ts.map +0 -1
- package/dist/cli/types.js +0 -7
- package/dist/cli/types.js.map +0 -1
- package/dist/cli/utils.d.ts +0 -29
- package/dist/cli/utils.d.ts.map +0 -1
- package/dist/cli/utils.js +0 -53
- package/dist/cli/utils.js.map +0 -1
- package/dist/cli.d.ts +0 -9
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -1805
- package/dist/config/generator.d.ts +0 -90
- package/dist/config/generator.d.ts.map +0 -1
- package/dist/config/generator.js +0 -320
- package/dist/config/generator.js.map +0 -1
- package/dist/config/loader.d.ts +0 -107
- package/dist/config/loader.d.ts.map +0 -1
- package/dist/config/loader.js +0 -251
- package/dist/config/loader.js.map +0 -1
- package/dist/config/schema.d.ts +0 -107
- package/dist/config/schema.d.ts.map +0 -1
- package/dist/config/schema.js +0 -169
- package/dist/config/schema.js.map +0 -1
- package/dist/enrich/audio-transcription.d.ts +0 -77
- package/dist/enrich/audio-transcription.d.ts.map +0 -1
- package/dist/enrich/audio-transcription.js +0 -370
- package/dist/enrich/audio-transcription.js.map +0 -1
- package/dist/enrich/checkpoint.d.ts +0 -137
- package/dist/enrich/checkpoint.d.ts.map +0 -1
- package/dist/enrich/checkpoint.js +0 -205
- package/dist/enrich/checkpoint.js.map +0 -1
- package/dist/enrich/idempotency.d.ts +0 -90
- package/dist/enrich/idempotency.d.ts.map +0 -1
- package/dist/enrich/idempotency.js +0 -188
- package/dist/enrich/idempotency.js.map +0 -1
- package/dist/enrich/image-analysis.d.ts +0 -62
- package/dist/enrich/image-analysis.d.ts.map +0 -1
- package/dist/enrich/image-analysis.js +0 -264
- package/dist/enrich/image-analysis.js.map +0 -1
- package/dist/enrich/index.d.ts +0 -60
- package/dist/enrich/index.d.ts.map +0 -1
- package/dist/enrich/index.js +0 -74
- package/dist/enrich/index.js.map +0 -1
- package/dist/enrich/link-enrichment.d.ts +0 -37
- package/dist/enrich/link-enrichment.d.ts.map +0 -1
- package/dist/enrich/link-enrichment.js +0 -202
- package/dist/enrich/link-enrichment.js.map +0 -1
- package/dist/enrich/pdf-video-handling.d.ts +0 -49
- package/dist/enrich/pdf-video-handling.d.ts.map +0 -1
- package/dist/enrich/pdf-video-handling.js +0 -325
- package/dist/enrich/pdf-video-handling.js.map +0 -1
- package/dist/enrich/progress-tracker.d.ts +0 -120
- package/dist/enrich/progress-tracker.d.ts.map +0 -1
- package/dist/enrich/progress-tracker.js +0 -220
- package/dist/enrich/progress-tracker.js.map +0 -1
- package/dist/enrich/providers/firecrawl.d.ts +0 -18
- package/dist/enrich/providers/firecrawl.d.ts.map +0 -1
- package/dist/enrich/providers/firecrawl.js +0 -48
- package/dist/enrich/providers/firecrawl.js.map +0 -1
- package/dist/enrich/providers/generic.d.ts +0 -16
- package/dist/enrich/providers/generic.d.ts.map +0 -1
- package/dist/enrich/providers/generic.js +0 -36
- package/dist/enrich/providers/generic.js.map +0 -1
- package/dist/enrich/providers/index.d.ts +0 -14
- package/dist/enrich/providers/index.d.ts.map +0 -1
- package/dist/enrich/providers/index.js +0 -13
- package/dist/enrich/providers/index.js.map +0 -1
- package/dist/enrich/providers/instagram.d.ts +0 -16
- package/dist/enrich/providers/instagram.d.ts.map +0 -1
- package/dist/enrich/providers/instagram.js +0 -43
- package/dist/enrich/providers/instagram.js.map +0 -1
- package/dist/enrich/providers/spotify.d.ts +0 -16
- package/dist/enrich/providers/spotify.d.ts.map +0 -1
- package/dist/enrich/providers/spotify.js +0 -45
- package/dist/enrich/providers/spotify.js.map +0 -1
- package/dist/enrich/providers/twitter.d.ts +0 -16
- package/dist/enrich/providers/twitter.d.ts.map +0 -1
- package/dist/enrich/providers/twitter.js +0 -43
- package/dist/enrich/providers/twitter.js.map +0 -1
- package/dist/enrich/providers/types.d.ts +0 -47
- package/dist/enrich/providers/types.d.ts.map +0 -1
- package/dist/enrich/providers/types.js +0 -15
- package/dist/enrich/providers/types.js.map +0 -1
- package/dist/enrich/providers/youtube.d.ts +0 -16
- package/dist/enrich/providers/youtube.d.ts.map +0 -1
- package/dist/enrich/providers/youtube.js +0 -43
- package/dist/enrich/providers/youtube.js.map +0 -1
- package/dist/enrich/rate-limiting.d.ts +0 -118
- package/dist/enrich/rate-limiting.d.ts.map +0 -1
- package/dist/enrich/rate-limiting.js +0 -258
- package/dist/enrich/rate-limiting.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/ingest/dedup-merge.d.ts +0 -82
- package/dist/ingest/dedup-merge.d.ts.map +0 -1
- package/dist/ingest/dedup-merge.js +0 -262
- package/dist/ingest/dedup-merge.js.map +0 -1
- package/dist/ingest/ingest-csv.d.ts +0 -62
- package/dist/ingest/ingest-csv.d.ts.map +0 -1
- package/dist/ingest/ingest-csv.js +0 -300
- package/dist/ingest/ingest-csv.js.map +0 -1
- package/dist/ingest/ingest-db.d.ts +0 -64
- package/dist/ingest/ingest-db.d.ts.map +0 -1
- package/dist/ingest/ingest-db.js +0 -172
- package/dist/ingest/ingest-db.js.map +0 -1
- package/dist/ingest/link-replies-and-tapbacks.d.ts +0 -53
- package/dist/ingest/link-replies-and-tapbacks.d.ts.map +0 -1
- package/dist/ingest/link-replies-and-tapbacks.js +0 -381
- package/dist/ingest/link-replies-and-tapbacks.js.map +0 -1
- package/dist/normalize/date-converters.d.ts +0 -45
- package/dist/normalize/date-converters.d.ts.map +0 -1
- package/dist/normalize/date-converters.js +0 -166
- package/dist/normalize/date-converters.js.map +0 -1
- package/dist/normalize/path-validator.d.ts +0 -65
- package/dist/normalize/path-validator.d.ts.map +0 -1
- package/dist/normalize/path-validator.js +0 -221
- package/dist/normalize/path-validator.js.map +0 -1
- package/dist/normalize/validate-normalized.d.ts +0 -45
- package/dist/normalize/validate-normalized.d.ts.map +0 -1
- package/dist/normalize/validate-normalized.js +0 -144
- package/dist/normalize/validate-normalized.js.map +0 -1
- package/dist/render/embeds-blockquotes.d.ts +0 -84
- package/dist/render/embeds-blockquotes.d.ts.map +0 -1
- package/dist/render/embeds-blockquotes.js +0 -204
- package/dist/render/embeds-blockquotes.js.map +0 -1
- package/dist/render/grouping.d.ts +0 -78
- package/dist/render/grouping.d.ts.map +0 -1
- package/dist/render/grouping.js +0 -134
- package/dist/render/grouping.js.map +0 -1
- package/dist/render/index.d.ts +0 -47
- package/dist/render/index.d.ts.map +0 -1
- package/dist/render/index.js +0 -245
- package/dist/render/index.js.map +0 -1
- package/dist/render/reply-rendering.d.ts +0 -88
- package/dist/render/reply-rendering.d.ts.map +0 -1
- package/dist/render/reply-rendering.js +0 -196
- package/dist/render/reply-rendering.js.map +0 -1
- package/dist/schema/message.d.ts +0 -125
- package/dist/schema/message.d.ts.map +0 -1
- package/dist/schema/message.js +0 -331
- package/dist/schema/message.js.map +0 -1
- package/dist/utils/delta-detection.d.ts +0 -107
- package/dist/utils/delta-detection.d.ts.map +0 -1
- package/dist/utils/delta-detection.js +0 -199
- package/dist/utils/delta-detection.js.map +0 -1
- package/dist/utils/enrichment-merge.d.ts +0 -135
- package/dist/utils/enrichment-merge.d.ts.map +0 -1
- package/dist/utils/enrichment-merge.js +0 -280
- package/dist/utils/enrichment-merge.js.map +0 -1
- package/dist/utils/human.d.ts +0 -15
- package/dist/utils/human.d.ts.map +0 -1
- package/dist/utils/human.js +0 -27
- package/dist/utils/human.js.map +0 -1
- package/dist/utils/incremental-state.d.ts +0 -133
- package/dist/utils/incremental-state.d.ts.map +0 -1
- package/dist/utils/incremental-state.js +0 -237
- package/dist/utils/incremental-state.js.map +0 -1
- package/dist/utils/logger.d.ts +0 -40
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js +0 -176
- package/dist/utils/logger.js.map +0 -1
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Render Markdown Command
|
|
3
|
-
*
|
|
4
|
-
* Generate Obsidian-compatible markdown timeline files.
|
|
5
|
-
* CLI-T04: Implement Render Command
|
|
6
|
-
*/
|
|
7
|
-
import { humanError, humanInfo, humanWarn } from '#utils/human';
|
|
8
|
-
import { applyLogLevel, cliLogger, logEvent } from '../utils.js';
|
|
9
|
-
/**
|
|
10
|
-
* Execute the render-markdown command logic
|
|
11
|
-
*/
|
|
12
|
-
export async function executeRenderMarkdown(options, globalOptions) {
|
|
13
|
-
const { input, output, startDate, endDate, groupByTime, nestedReplies, maxNestingDepth, } = options;
|
|
14
|
-
const { verbose, quiet } = globalOptions;
|
|
15
|
-
applyLogLevel(verbose, quiet);
|
|
16
|
-
logEvent('render-start', {
|
|
17
|
-
command: 'render-markdown',
|
|
18
|
-
phase: 'start',
|
|
19
|
-
options: {
|
|
20
|
-
input,
|
|
21
|
-
output,
|
|
22
|
-
startDate,
|
|
23
|
-
endDate,
|
|
24
|
-
groupByTime,
|
|
25
|
-
nestedReplies,
|
|
26
|
-
maxNestingDepth,
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
// CLI-T04-AC01: Date filtering validation
|
|
30
|
-
const fs = await import('node:fs');
|
|
31
|
-
if (!fs.existsSync(input)) {
|
|
32
|
-
humanError(`❌ Input file not found: ${input}`);
|
|
33
|
-
process.exit(1);
|
|
34
|
-
}
|
|
35
|
-
let startDateObj = null;
|
|
36
|
-
let endDateObj = null;
|
|
37
|
-
if (startDate) {
|
|
38
|
-
const start = new Date(startDate);
|
|
39
|
-
if (Number.isNaN(start.getTime())) {
|
|
40
|
-
humanError(`❌ Invalid start date: ${startDate} (use YYYY-MM-DD format)`);
|
|
41
|
-
process.exit(1);
|
|
42
|
-
}
|
|
43
|
-
startDateObj = start;
|
|
44
|
-
}
|
|
45
|
-
if (endDate) {
|
|
46
|
-
const end = new Date(endDate);
|
|
47
|
-
if (Number.isNaN(end.getTime())) {
|
|
48
|
-
humanError(`❌ Invalid end date: ${endDate} (use YYYY-MM-DD format)`);
|
|
49
|
-
process.exit(1);
|
|
50
|
-
}
|
|
51
|
-
// Set to end of day
|
|
52
|
-
end.setHours(23, 59, 59, 999);
|
|
53
|
-
endDateObj = end;
|
|
54
|
-
}
|
|
55
|
-
// CLI-T04-AC03: Validate max nesting depth
|
|
56
|
-
const maxNestingDepthNum = Number.parseInt(maxNestingDepth, 10);
|
|
57
|
-
if (Number.isNaN(maxNestingDepthNum) || maxNestingDepthNum < 1) {
|
|
58
|
-
humanError('❌ --max-nesting-depth must be a positive number');
|
|
59
|
-
process.exit(1);
|
|
60
|
-
}
|
|
61
|
-
if (verbose) {
|
|
62
|
-
humanInfo(`📄 Input: ${input}`);
|
|
63
|
-
humanInfo(`📁 Output directory: ${output}`);
|
|
64
|
-
if (startDateObj) {
|
|
65
|
-
humanInfo(`📅 Start date: ${startDate}`);
|
|
66
|
-
}
|
|
67
|
-
if (endDateObj) {
|
|
68
|
-
humanInfo(`📅 End date: ${endDate}`);
|
|
69
|
-
}
|
|
70
|
-
humanInfo(`⏱️ Group by time: ${groupByTime}`);
|
|
71
|
-
humanInfo(`⬅️ Nested replies: ${nestedReplies}`);
|
|
72
|
-
humanInfo(`📊 Max nesting depth: ${maxNestingDepthNum}`);
|
|
73
|
-
}
|
|
74
|
-
// Load input messages
|
|
75
|
-
const content = fs.readFileSync(input, 'utf-8');
|
|
76
|
-
const data = JSON.parse(content);
|
|
77
|
-
let messages = Array.isArray(data) ? data : data.messages || [];
|
|
78
|
-
if (verbose) {
|
|
79
|
-
humanInfo(`✓ Loaded ${messages.length.toLocaleString()} messages`);
|
|
80
|
-
}
|
|
81
|
-
// Filter by date range if specified
|
|
82
|
-
if (startDateObj || endDateObj) {
|
|
83
|
-
const filtered = messages.filter((msg) => {
|
|
84
|
-
const msgDate = new Date(msg.date);
|
|
85
|
-
if (startDateObj && msgDate < startDateObj)
|
|
86
|
-
return false;
|
|
87
|
-
if (endDateObj && msgDate > endDateObj)
|
|
88
|
-
return false;
|
|
89
|
-
return true;
|
|
90
|
-
});
|
|
91
|
-
humanInfo(`📊 Filtered to ${filtered.length.toLocaleString()} messages in date range`);
|
|
92
|
-
logEvent('render-filtered', {
|
|
93
|
-
command: 'render-markdown',
|
|
94
|
-
phase: 'progress',
|
|
95
|
-
metrics: { filtered: filtered.length, original: messages.length },
|
|
96
|
-
options: {
|
|
97
|
-
startDate: startDateObj ? startDateObj.toISOString() : undefined,
|
|
98
|
-
endDate: endDateObj ? endDateObj.toISOString() : undefined,
|
|
99
|
-
},
|
|
100
|
-
});
|
|
101
|
-
messages = filtered;
|
|
102
|
-
}
|
|
103
|
-
// Import render functions
|
|
104
|
-
const { renderMessages } = await import('../../render/index.js');
|
|
105
|
-
// Render messages to markdown
|
|
106
|
-
const rendered = renderMessages(messages);
|
|
107
|
-
if (rendered.size === 0) {
|
|
108
|
-
humanWarn('⚠️ No messages to render');
|
|
109
|
-
process.exit(0);
|
|
110
|
-
}
|
|
111
|
-
// CLI-T04-AC04: Create output directory if doesn't exist
|
|
112
|
-
const path = await import('node:path');
|
|
113
|
-
const outputDir = path.resolve(output || './timeline');
|
|
114
|
-
if (!fs.existsSync(outputDir)) {
|
|
115
|
-
fs.mkdirSync(outputDir, { recursive: true });
|
|
116
|
-
if (verbose) {
|
|
117
|
-
cliLogger.info('Created output directory', { outputDir });
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
// Write markdown files
|
|
121
|
-
let filesWritten = 0;
|
|
122
|
-
const dates = Array.from(rendered.keys()).sort();
|
|
123
|
-
for (const date of dates) {
|
|
124
|
-
const markdown = rendered.get(date);
|
|
125
|
-
if (!markdown)
|
|
126
|
-
continue;
|
|
127
|
-
const filename = `${date}.md`;
|
|
128
|
-
const filepath = path.join(outputDir, filename);
|
|
129
|
-
fs.writeFileSync(filepath, markdown, 'utf-8');
|
|
130
|
-
filesWritten++;
|
|
131
|
-
if (verbose) {
|
|
132
|
-
humanInfo(`✓ Wrote ${filename}`);
|
|
133
|
-
logEvent('render-file-written', {
|
|
134
|
-
command: 'render-markdown',
|
|
135
|
-
phase: 'progress',
|
|
136
|
-
metrics: { filesWritten },
|
|
137
|
-
context: { filename, filepath },
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
// CLI-T04-AC05: Summary output
|
|
142
|
-
humanInfo(`\n✅ Rendered ${filesWritten} markdown file(s)`);
|
|
143
|
-
humanInfo(`✓ Wrote ${filesWritten.toLocaleString()} markdown file${filesWritten === 1 ? '' : 's'} to ${outputDir}`);
|
|
144
|
-
// Message summary
|
|
145
|
-
const textMessages = messages.filter((m) => m.messageKind === 'text').length;
|
|
146
|
-
const mediaMessages = messages.filter((m) => m.messageKind === 'media').length;
|
|
147
|
-
const tapbacks = messages.filter((m) => m.messageKind === 'tapback').length;
|
|
148
|
-
humanInfo('\n📊 Message Summary:');
|
|
149
|
-
humanInfo(` Total: ${messages.length.toLocaleString()}`);
|
|
150
|
-
humanInfo(` Text: ${textMessages.toLocaleString()}`);
|
|
151
|
-
humanInfo(` Media: ${mediaMessages.toLocaleString()}`);
|
|
152
|
-
humanInfo(` Tapbacks: ${tapbacks.toLocaleString()}`);
|
|
153
|
-
logEvent('render-summary', {
|
|
154
|
-
command: 'render-markdown',
|
|
155
|
-
phase: 'summary',
|
|
156
|
-
metrics: {
|
|
157
|
-
filesWritten,
|
|
158
|
-
totalMessages: messages.length,
|
|
159
|
-
textMessages,
|
|
160
|
-
mediaMessages,
|
|
161
|
-
tapbacks,
|
|
162
|
-
},
|
|
163
|
-
options: {
|
|
164
|
-
outputDir,
|
|
165
|
-
groupByTime,
|
|
166
|
-
nestedReplies,
|
|
167
|
-
maxNestingDepth: maxNestingDepthNum,
|
|
168
|
-
},
|
|
169
|
-
exitCode: 0,
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Register the render-markdown command with Commander
|
|
174
|
-
*/
|
|
175
|
-
export function registerRenderMarkdownCommand(program, getGlobalOptions) {
|
|
176
|
-
program
|
|
177
|
-
.command('render-markdown')
|
|
178
|
-
.description('Generate Obsidian-compatible markdown timeline files')
|
|
179
|
-
.requiredOption('-i, --input <path>', 'input enriched JSON file')
|
|
180
|
-
.option('-o, --output <dir>', 'output directory for markdown files', './timeline')
|
|
181
|
-
.option('--start-date <date>', 'render messages from this date (YYYY-MM-DD)')
|
|
182
|
-
.option('--end-date <date>', 'render messages until this date (YYYY-MM-DD)')
|
|
183
|
-
.option('--group-by-time', 'group messages by time-of-day (Morning/Afternoon/Evening)', true)
|
|
184
|
-
.option('--nested-replies', 'render replies as nested blockquotes', true)
|
|
185
|
-
.option('--max-nesting-depth <n>', 'maximum nesting depth for replies (default 10)', '10')
|
|
186
|
-
.action(async (options) => {
|
|
187
|
-
try {
|
|
188
|
-
await executeRenderMarkdown(options, getGlobalOptions());
|
|
189
|
-
process.exit(0);
|
|
190
|
-
}
|
|
191
|
-
catch (error) {
|
|
192
|
-
humanError('❌ Failed to render markdown:', error instanceof Error ? error.message : String(error));
|
|
193
|
-
if (getGlobalOptions().verbose && error instanceof Error) {
|
|
194
|
-
humanError(error.stack);
|
|
195
|
-
}
|
|
196
|
-
logEvent('render-error', {
|
|
197
|
-
command: 'render-markdown',
|
|
198
|
-
phase: 'error',
|
|
199
|
-
error: {
|
|
200
|
-
type: error instanceof Error ? error.name : 'Unknown',
|
|
201
|
-
message: error instanceof Error ? error.message : String(error),
|
|
202
|
-
...(error instanceof Error && error.stack
|
|
203
|
-
? { stack: error.stack }
|
|
204
|
-
: {}),
|
|
205
|
-
},
|
|
206
|
-
options: {
|
|
207
|
-
output: options.output,
|
|
208
|
-
groupByTime: options.groupByTime,
|
|
209
|
-
nestedReplies: options.nestedReplies,
|
|
210
|
-
maxNestingDepth: options.maxNestingDepth,
|
|
211
|
-
},
|
|
212
|
-
exitCode: 2,
|
|
213
|
-
});
|
|
214
|
-
process.exit(2);
|
|
215
|
-
}
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
//# sourceMappingURL=render-markdown.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"render-markdown.js","sourceRoot":"","sources":["../../../src/cli/commands/render-markdown.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAG/D,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEhE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAC1C,OAA8B,EAC9B,aAA4B;IAE5B,MAAM,EACL,KAAK,EACL,MAAM,EACN,SAAS,EACT,OAAO,EACP,WAAW,EACX,aAAa,EACb,eAAe,GACf,GAAG,OAAO,CAAA;IACX,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,aAAa,CAAA;IAExC,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;IAE7B,QAAQ,CAAC,cAAc,EAAE;QACxB,OAAO,EAAE,iBAAiB;QAC1B,KAAK,EAAE,OAAO;QACd,OAAO,EAAE;YACR,KAAK;YACL,MAAM;YACN,SAAS;YACT,OAAO;YACP,WAAW;YACX,aAAa;YACb,eAAe;SACf;KACD,CAAC,CAAA;IAEF,0CAA0C;IAC1C,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,CAAA;IAClC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,C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E,CAAC;iBACN;gBACD,OAAO,EAAE;oBACR,MAAM,EAAE,OAAO,CAAC,MAAM;oBACtB,WAAW,EAAE,OAAO,CAAC,WAAW;oBAChC,aAAa,EAAE,OAAO,CAAC,aAAa;oBACpC,eAAe,EAAE,OAAO,CAAC,eAAe;iBACxC;gBACD,QAAQ,EAAE,CAAC;aACX,CAAC,CAAA;YACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QAChB,CAAC;IACF,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Stats Command
|
|
3
|
-
*
|
|
4
|
-
* Show statistics for message file.
|
|
5
|
-
* CLI-T05-AC02: stats command to show message counts by type
|
|
6
|
-
*/
|
|
7
|
-
import type { Command } from 'commander';
|
|
8
|
-
import type { GlobalOptions, StatsOptions } from '../types.js';
|
|
9
|
-
/**
|
|
10
|
-
* Execute the stats command logic
|
|
11
|
-
*/
|
|
12
|
-
export declare function executeStats(options: StatsOptions, globalOptions: GlobalOptions): Promise<void>;
|
|
13
|
-
/**
|
|
14
|
-
* Register the stats command with Commander
|
|
15
|
-
*/
|
|
16
|
-
export declare function registerStatsCommand(program: Command, getGlobalOptions: () => GlobalOptions): void;
|
|
17
|
-
//# sourceMappingURL=stats.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/stats.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAGxC,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG9D;;GAEG;AACH,wBAAsB,YAAY,CACjC,OAAO,EAAE,YAAY,EACrB,aAAa,EAAE,aAAa,GAC1B,OAAO,CAAC,IAAI,CAAC,CA8If;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CACnC,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,MAAM,aAAa,GACnC,IAAI,CAkCN"}
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Stats Command
|
|
3
|
-
*
|
|
4
|
-
* Show statistics for message file.
|
|
5
|
-
* CLI-T05-AC02: stats command to show message counts by type
|
|
6
|
-
*/
|
|
7
|
-
import { humanError, humanInfo } from '#utils/human';
|
|
8
|
-
import { applyLogLevel, logEvent } from '../utils.js';
|
|
9
|
-
/**
|
|
10
|
-
* Execute the stats command logic
|
|
11
|
-
*/
|
|
12
|
-
export async function executeStats(options, globalOptions) {
|
|
13
|
-
const { input } = options;
|
|
14
|
-
const verbose = globalOptions.verbose || options.verbose || false;
|
|
15
|
-
applyLogLevel(verbose, globalOptions.quiet);
|
|
16
|
-
logEvent('stats-start', {
|
|
17
|
-
command: 'stats',
|
|
18
|
-
phase: 'start',
|
|
19
|
-
options: { input },
|
|
20
|
-
});
|
|
21
|
-
const fs = await import('node:fs');
|
|
22
|
-
// Validate input file exists
|
|
23
|
-
if (!fs.existsSync(input)) {
|
|
24
|
-
humanError(`❌ Input file not found: ${input}`);
|
|
25
|
-
process.exit(1);
|
|
26
|
-
}
|
|
27
|
-
// Load and parse JSON
|
|
28
|
-
const content = fs.readFileSync(input, 'utf-8');
|
|
29
|
-
let data;
|
|
30
|
-
try {
|
|
31
|
-
data = JSON.parse(content);
|
|
32
|
-
}
|
|
33
|
-
catch {
|
|
34
|
-
humanError(`❌ Invalid JSON: ${input}`);
|
|
35
|
-
process.exit(1);
|
|
36
|
-
}
|
|
37
|
-
// Extract messages
|
|
38
|
-
const messages = Array.isArray(data)
|
|
39
|
-
? data
|
|
40
|
-
: data.messages || [];
|
|
41
|
-
// Count by messageKind
|
|
42
|
-
const stats = {
|
|
43
|
-
total: messages.length,
|
|
44
|
-
text: 0,
|
|
45
|
-
media: 0,
|
|
46
|
-
tapback: 0,
|
|
47
|
-
notification: 0,
|
|
48
|
-
withMedia: 0,
|
|
49
|
-
withEnrichment: 0,
|
|
50
|
-
dateRange: { min: null, max: null },
|
|
51
|
-
};
|
|
52
|
-
const senders = new Set();
|
|
53
|
-
let totalEnrichments = 0;
|
|
54
|
-
messages.forEach((msg) => {
|
|
55
|
-
if (msg.messageKind === 'text')
|
|
56
|
-
stats.text++;
|
|
57
|
-
if (msg.messageKind === 'media')
|
|
58
|
-
stats.media++;
|
|
59
|
-
if (msg.messageKind === 'tapback')
|
|
60
|
-
stats.tapback++;
|
|
61
|
-
if (msg.messageKind === 'notification')
|
|
62
|
-
stats.notification++;
|
|
63
|
-
if (msg.media) {
|
|
64
|
-
stats.withMedia++;
|
|
65
|
-
if (msg.media.enrichment && Array.isArray(msg.media.enrichment)) {
|
|
66
|
-
stats.withEnrichment++;
|
|
67
|
-
totalEnrichments += msg.media.enrichment.length;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
const sender = msg.handle ?? (msg.isFromMe ? 'Me' : 'Unknown');
|
|
71
|
-
senders.add(sender);
|
|
72
|
-
if (msg.date) {
|
|
73
|
-
if (!stats.dateRange.min || msg.date < stats.dateRange.min) {
|
|
74
|
-
stats.dateRange.min = msg.date;
|
|
75
|
-
}
|
|
76
|
-
if (!stats.dateRange.max || msg.date > stats.dateRange.max) {
|
|
77
|
-
stats.dateRange.max = msg.date;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
// Output summary
|
|
82
|
-
humanInfo('📊 Message Statistics');
|
|
83
|
-
humanInfo(`\n Total messages: ${stats.total.toLocaleString()}`);
|
|
84
|
-
humanInfo('\n Message Types:');
|
|
85
|
-
humanInfo(` Text: ${stats.text}`);
|
|
86
|
-
humanInfo(` Media: ${stats.media}`);
|
|
87
|
-
humanInfo(` Tapbacks: ${stats.tapback}`);
|
|
88
|
-
humanInfo(` Notifications: ${stats.notification}`);
|
|
89
|
-
humanInfo('\n Enrichment:');
|
|
90
|
-
humanInfo(` Messages with media: ${stats.withMedia}`);
|
|
91
|
-
humanInfo(` Messages with enrichment: ${stats.withEnrichment}`);
|
|
92
|
-
if (stats.withEnrichment > 0) {
|
|
93
|
-
humanInfo(` Total enrichments: ${totalEnrichments}`);
|
|
94
|
-
humanInfo(` Avg enrichments per message: ${(totalEnrichments / stats.withEnrichment).toFixed(2)}`);
|
|
95
|
-
}
|
|
96
|
-
humanInfo('\n Date Range:');
|
|
97
|
-
if (stats.dateRange.min && stats.dateRange.max) {
|
|
98
|
-
humanInfo(` From: ${stats.dateRange.min}`);
|
|
99
|
-
humanInfo(` To: ${stats.dateRange.max}`);
|
|
100
|
-
const minDate = new Date(stats.dateRange.min);
|
|
101
|
-
const maxDate = new Date(stats.dateRange.max);
|
|
102
|
-
const days = Math.floor((maxDate.getTime() - minDate.getTime()) / (1000 * 60 * 60 * 24));
|
|
103
|
-
humanInfo(` Duration: ${days + 1} days`);
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
humanInfo(' None');
|
|
107
|
-
}
|
|
108
|
-
if (verbose) {
|
|
109
|
-
humanInfo(`\n Participants: ${senders.size}`);
|
|
110
|
-
if (senders.size > 0 && senders.size <= 20) {
|
|
111
|
-
Array.from(senders)
|
|
112
|
-
.sort()
|
|
113
|
-
.forEach((sender) => {
|
|
114
|
-
const count = messages.filter((m) => {
|
|
115
|
-
const msgSender = m.handle ?? (m.isFromMe ? 'Me' : 'Unknown');
|
|
116
|
-
return msgSender === sender;
|
|
117
|
-
}).length;
|
|
118
|
-
humanInfo(` ${sender}: ${count}`);
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
logEvent('stats-summary', {
|
|
123
|
-
command: 'stats',
|
|
124
|
-
phase: 'summary',
|
|
125
|
-
metrics: {
|
|
126
|
-
total: stats.total,
|
|
127
|
-
text: stats.text,
|
|
128
|
-
media: stats.media,
|
|
129
|
-
tapback: stats.tapback,
|
|
130
|
-
notification: stats.notification,
|
|
131
|
-
withMedia: stats.withMedia,
|
|
132
|
-
withEnrichment: stats.withEnrichment,
|
|
133
|
-
participants: senders.size,
|
|
134
|
-
},
|
|
135
|
-
options: { input, verbose },
|
|
136
|
-
exitCode: 0,
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Register the stats command with Commander
|
|
141
|
-
*/
|
|
142
|
-
export function registerStatsCommand(program, getGlobalOptions) {
|
|
143
|
-
program
|
|
144
|
-
.command('stats')
|
|
145
|
-
.description('Show statistics for message file')
|
|
146
|
-
.requiredOption('-i, --input <path>', 'path to message JSON file')
|
|
147
|
-
.option('-v, --verbose', 'show detailed statistics', false)
|
|
148
|
-
.action(async (options) => {
|
|
149
|
-
try {
|
|
150
|
-
await executeStats(options, getGlobalOptions());
|
|
151
|
-
process.exit(0);
|
|
152
|
-
}
|
|
153
|
-
catch (error) {
|
|
154
|
-
humanError('❌ Stats failed:', error instanceof Error ? error.message : String(error));
|
|
155
|
-
if (getGlobalOptions().verbose && error instanceof Error) {
|
|
156
|
-
humanError(error.stack);
|
|
157
|
-
}
|
|
158
|
-
logEvent('stats-error', {
|
|
159
|
-
command: 'stats',
|
|
160
|
-
phase: 'error',
|
|
161
|
-
error: {
|
|
162
|
-
type: error instanceof Error ? error.name : 'Unknown',
|
|
163
|
-
message: error instanceof Error ? error.message : String(error),
|
|
164
|
-
...(error instanceof Error && error.stack
|
|
165
|
-
? { stack: error.stack }
|
|
166
|
-
: {}),
|
|
167
|
-
},
|
|
168
|
-
options: { input: options.input, verbose: options.verbose },
|
|
169
|
-
exitCode: 2,
|
|
170
|
-
});
|
|
171
|
-
process.exit(2);
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
//# sourceMappingURL=stats.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stats.js","sourceRoot":"","sources":["../../../src/cli/commands/stats.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,UAAU,EAAE,SAAS,E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C,CAAA;QAChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,UAAU,CACT,iBAAiB,EACjB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CACtD,CAAA;YACD,IAAI,gBAAgB,EAAE,CAAC,OAAO,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;gBAC1D,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;YACxB,CAAC;YACD,QAAQ,CAAC,aAAa,EAAE;gBACvB,OAAO,EAAE,OAAO;gBAChB,KAAK,EAAE,OAAO;gBACd,KAAK,EAAE;oBACN,IAAI,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;oBACrD,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;oBAC/D,GAAG,CAAC,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,KAAK;wBACxC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE;wBACxB,CAAC,CAAC,EAAE,CAAC;iBACN;gBACD,OAAO,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE;gBAC3D,QAAQ,EAAE,CAAC;aACX,CAAC,CAAA;YACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QAChB,CAAC;IACF,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Validate Command
|
|
3
|
-
*
|
|
4
|
-
* Validate JSON file against message schema.
|
|
5
|
-
* CLI-T05-AC01: validate command to check JSON against schema
|
|
6
|
-
*/
|
|
7
|
-
import type { Command } from 'commander';
|
|
8
|
-
import type { GlobalOptions, ValidateOptions } from '../types.js';
|
|
9
|
-
/**
|
|
10
|
-
* Execute the validate command logic
|
|
11
|
-
*/
|
|
12
|
-
export declare function executeValidate(options: ValidateOptions, globalOptions: GlobalOptions): Promise<void>;
|
|
13
|
-
/**
|
|
14
|
-
* Register the validate command with Commander
|
|
15
|
-
*/
|
|
16
|
-
export declare function registerValidateCommand(program: Command, getGlobalOptions: () => GlobalOptions): void;
|
|
17
|
-
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/validate.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAExC,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAGjE;;GAEG;AACH,wBAAsB,eAAe,CACpC,OAAO,EAAE,eAAe,EACxB,aAAa,EAAE,aAAa,GAC1B,OAAO,CAAC,IAAI,CAAC,CAsHf;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACtC,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,MAAM,aAAa,GACnC,IAAI,CAgCN"}
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Validate Command
|
|
3
|
-
*
|
|
4
|
-
* Validate JSON file against message schema.
|
|
5
|
-
* CLI-T05-AC01: validate command to check JSON against schema
|
|
6
|
-
*/
|
|
7
|
-
import { humanError, humanInfo } from '#utils/human';
|
|
8
|
-
import { applyLogLevel, logEvent } from '../utils.js';
|
|
9
|
-
/**
|
|
10
|
-
* Execute the validate command logic
|
|
11
|
-
*/
|
|
12
|
-
export async function executeValidate(options, globalOptions) {
|
|
13
|
-
const { input, quiet } = options;
|
|
14
|
-
const { verbose } = globalOptions;
|
|
15
|
-
applyLogLevel(verbose, globalOptions.quiet);
|
|
16
|
-
const fs = await import('node:fs');
|
|
17
|
-
// Validate input file exists
|
|
18
|
-
if (!fs.existsSync(input)) {
|
|
19
|
-
humanError(`❌ Input file not found: ${input}`);
|
|
20
|
-
process.exit(1);
|
|
21
|
-
}
|
|
22
|
-
// Load and parse JSON
|
|
23
|
-
const content = fs.readFileSync(input, 'utf-8');
|
|
24
|
-
let data;
|
|
25
|
-
try {
|
|
26
|
-
data = JSON.parse(content);
|
|
27
|
-
}
|
|
28
|
-
catch (e) {
|
|
29
|
-
humanError(`❌ Invalid JSON: ${input}`);
|
|
30
|
-
humanError(` ${e instanceof Error ? e.message : String(e)}`);
|
|
31
|
-
process.exit(1);
|
|
32
|
-
}
|
|
33
|
-
// Validate schema
|
|
34
|
-
const { MessageSchema } = await import('../../schema/message.js');
|
|
35
|
-
const messages = Array.isArray(data)
|
|
36
|
-
? data
|
|
37
|
-
: data.messages || [];
|
|
38
|
-
let validCount = 0;
|
|
39
|
-
const errors = [];
|
|
40
|
-
for (let i = 0; i < messages.length; i++) {
|
|
41
|
-
const result = MessageSchema.safeParse(messages[i]);
|
|
42
|
-
if (result.success) {
|
|
43
|
-
validCount++;
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
result.error.errors.forEach((err) => {
|
|
47
|
-
errors.push({
|
|
48
|
-
index: i,
|
|
49
|
-
path: err.path.join('.'),
|
|
50
|
-
message: err.message,
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
// Output results
|
|
56
|
-
if (!quiet) {
|
|
57
|
-
humanInfo('📊 Validation Results:');
|
|
58
|
-
humanInfo(` Valid: ${validCount}/${messages.length}`);
|
|
59
|
-
}
|
|
60
|
-
logEvent('validate-results', {
|
|
61
|
-
command: 'validate',
|
|
62
|
-
phase: 'progress',
|
|
63
|
-
metrics: {
|
|
64
|
-
valid: validCount,
|
|
65
|
-
total: messages.length,
|
|
66
|
-
errors: errors.length,
|
|
67
|
-
},
|
|
68
|
-
options: { quiet },
|
|
69
|
-
});
|
|
70
|
-
if (errors.length === 0) {
|
|
71
|
-
humanInfo(`✅ All ${messages.length} messages are valid`);
|
|
72
|
-
logEvent('validate-summary', {
|
|
73
|
-
command: 'validate',
|
|
74
|
-
phase: 'summary',
|
|
75
|
-
metrics: { valid: validCount, total: messages.length },
|
|
76
|
-
exitCode: 0,
|
|
77
|
-
});
|
|
78
|
-
process.exit(0);
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
humanError(`❌ ${errors.length} validation error(s) found`);
|
|
82
|
-
logEvent('validate-error-summary', {
|
|
83
|
-
command: 'validate',
|
|
84
|
-
phase: 'error',
|
|
85
|
-
metrics: {
|
|
86
|
-
valid: validCount,
|
|
87
|
-
total: messages.length,
|
|
88
|
-
errors: errors.length,
|
|
89
|
-
},
|
|
90
|
-
exitCode: 1,
|
|
91
|
-
});
|
|
92
|
-
if (!quiet) {
|
|
93
|
-
const grouped = new Map();
|
|
94
|
-
errors.forEach((err) => {
|
|
95
|
-
if (!grouped.has(err.index))
|
|
96
|
-
grouped.set(err.index, []);
|
|
97
|
-
grouped.get(err.index).push({ path: err.path, message: err.message });
|
|
98
|
-
});
|
|
99
|
-
let shown = 0;
|
|
100
|
-
grouped.forEach((errs, index) => {
|
|
101
|
-
if (shown < 10) {
|
|
102
|
-
humanError(`\n Message ${index}:`);
|
|
103
|
-
errs.forEach((err) => {
|
|
104
|
-
humanError(` ${err.path || 'root'}: ${err.message}`);
|
|
105
|
-
shown++;
|
|
106
|
-
if (shown >= 10)
|
|
107
|
-
return;
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
if (shown < errors.length) {
|
|
112
|
-
humanError(`\n ... and ${errors.length - shown} more errors`);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
process.exit(1);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Register the validate command with Commander
|
|
120
|
-
*/
|
|
121
|
-
export function registerValidateCommand(program, getGlobalOptions) {
|
|
122
|
-
program
|
|
123
|
-
.command('validate')
|
|
124
|
-
.description('Validate JSON file against message schema')
|
|
125
|
-
.requiredOption('-i, --input <path>', 'path to JSON file to validate')
|
|
126
|
-
.option('-q, --quiet', 'suppress detailed error messages', false)
|
|
127
|
-
.action(async (options) => {
|
|
128
|
-
try {
|
|
129
|
-
await executeValidate(options, getGlobalOptions());
|
|
130
|
-
}
|
|
131
|
-
catch (error) {
|
|
132
|
-
humanError('❌ Validation failed:', error instanceof Error ? error.message : String(error));
|
|
133
|
-
if (getGlobalOptions().verbose && error instanceof Error) {
|
|
134
|
-
humanError(error.stack);
|
|
135
|
-
}
|
|
136
|
-
logEvent('validate-runtime-error', {
|
|
137
|
-
command: 'validate',
|
|
138
|
-
phase: 'error',
|
|
139
|
-
error: {
|
|
140
|
-
type: error instanceof Error ? error.name : 'Unknown',
|
|
141
|
-
message: error instanceof Error ? error.message : String(error),
|
|
142
|
-
...(error instanceof Error && error.stack
|
|
143
|
-
? { stack: error.stack }
|
|
144
|
-
: {}),
|
|
145
|
-
},
|
|
146
|
-
exitCode: 2,
|
|
147
|
-
});
|
|
148
|
-
process.exit(2);
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
//# sourceMappingURL=validate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/cli/commands/validate.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAEpD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAErD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACpC,OAAwB,EACxB,aAA4B;IAE5B,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,OAAO,CAAA;IAChC,MAAM,EAAE,OAAO,EAAE,GAAG,aAAa,CAA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CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;oBAC/D,GAAG,CAAC,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,KAAK;wBACxC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE;wBACxB,CAAC,CAAC,EAAE,CAAC;iBACN;gBACD,QAAQ,EAAE,CAAC;aACX,CAAC,CAAA;YACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QAChB,CAAC;IACF,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
package/dist/cli/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* iMessage Timeline CLI
|
|
4
|
-
*
|
|
5
|
-
* Main CLI entry point that registers all commands and handles execution.
|
|
6
|
-
* This is the modular replacement for the monolithic cli.ts file.
|
|
7
|
-
*/
|
|
8
|
-
import { Command } from 'commander';
|
|
9
|
-
/**
|
|
10
|
-
* Creates and configures the main CLI program with all commands.
|
|
11
|
-
*/
|
|
12
|
-
export declare function createProgram(): Command;
|
|
13
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/cli/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AACA;;;;;GAKG;AAMH,OAAO,EAAE,OAAO,EAAuB,MAAM,WAAW,CAAA;AA2BxD;;GAEG;AACH,wBAAgB,aAAa,IAAI,OAAO,CA8FvC"}
|