dashcam 1.0.1-beta.11 → 1.0.1-beta.13
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/bin/dashcam.js +91 -144
- package/package.json +1 -1
- package/BACKWARD_COMPATIBILITY.md +0 -177
package/bin/dashcam.js
CHANGED
|
@@ -29,10 +29,6 @@ program
|
|
|
29
29
|
.description('Capture the steps to reproduce every bug.')
|
|
30
30
|
.version(APP.version)
|
|
31
31
|
.option('-v, --verbose', 'Enable verbose logging output')
|
|
32
|
-
.option('-t, --title <string>', 'Title of the replay (used with create/default action)')
|
|
33
|
-
.option('-d, --description [text]', 'Replay markdown body (used with create/default action)')
|
|
34
|
-
.option('--md', 'Returns code for a rich markdown image link (used with create/default action)')
|
|
35
|
-
.option('-k, --project <project>', 'Project ID to publish to (used with create/default action)')
|
|
36
32
|
.hook('preAction', (thisCommand) => {
|
|
37
33
|
// Enable verbose logging if the flag is set
|
|
38
34
|
if (thisCommand.opts().verbose) {
|
|
@@ -152,76 +148,6 @@ async function recordingAction(options, command) {
|
|
|
152
148
|
}
|
|
153
149
|
}
|
|
154
150
|
|
|
155
|
-
// Shared create/clip action
|
|
156
|
-
async function createClipAction(options) {
|
|
157
|
-
try {
|
|
158
|
-
// Check for piped input (description from stdin)
|
|
159
|
-
let description = options.description;
|
|
160
|
-
if (!description && !process.stdin.isTTY) {
|
|
161
|
-
const chunks = [];
|
|
162
|
-
for await (const chunk of process.stdin) {
|
|
163
|
-
chunks.push(chunk);
|
|
164
|
-
}
|
|
165
|
-
description = Buffer.concat(chunks).toString('utf-8');
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
if (!processManager.isRecordingActive()) {
|
|
169
|
-
console.log('No active recording to create clip from');
|
|
170
|
-
console.log('Start a recording first with "dashcam record" or "dashcam start"');
|
|
171
|
-
process.exit(0);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
const activeStatus = processManager.getActiveStatus();
|
|
175
|
-
|
|
176
|
-
console.log('Creating clip from recording...');
|
|
177
|
-
|
|
178
|
-
const result = await processManager.stopActiveRecording();
|
|
179
|
-
|
|
180
|
-
if (!result) {
|
|
181
|
-
console.log('Failed to stop recording');
|
|
182
|
-
process.exit(1);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
console.log('Recording stopped successfully');
|
|
186
|
-
|
|
187
|
-
// Upload the recording
|
|
188
|
-
console.log('Uploading clip...');
|
|
189
|
-
try {
|
|
190
|
-
const uploadResult = await upload(result.outputPath, {
|
|
191
|
-
title: options.title || activeStatus?.options?.title || 'Dashcam Recording',
|
|
192
|
-
description: description || activeStatus?.options?.description,
|
|
193
|
-
project: options.project || options.k || activeStatus?.options?.project,
|
|
194
|
-
duration: result.duration,
|
|
195
|
-
clientStartDate: result.clientStartDate,
|
|
196
|
-
apps: result.apps,
|
|
197
|
-
icons: result.icons,
|
|
198
|
-
gifPath: result.gifPath,
|
|
199
|
-
snapshotPath: result.snapshotPath
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
// Output based on format option
|
|
203
|
-
if (options.md) {
|
|
204
|
-
const replayId = uploadResult.replay?.id;
|
|
205
|
-
const shareKey = uploadResult.shareLink.split('share=')[1];
|
|
206
|
-
console.log(`[](${uploadResult.shareLink})`);
|
|
207
|
-
console.log('');
|
|
208
|
-
console.log(`Watch [Dashcam - ${options.title || 'New Replay'}](${uploadResult.shareLink}) on Dashcam`);
|
|
209
|
-
} else {
|
|
210
|
-
console.log(uploadResult.shareLink);
|
|
211
|
-
}
|
|
212
|
-
} catch (uploadError) {
|
|
213
|
-
console.error('Upload failed:', uploadError.message);
|
|
214
|
-
console.log('Recording saved locally:', result.outputPath);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
process.exit(0);
|
|
218
|
-
} catch (error) {
|
|
219
|
-
logger.error('Error creating clip:', error);
|
|
220
|
-
console.error('Failed to create clip:', error.message);
|
|
221
|
-
process.exit(1);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
151
|
// 'create' command - creates a clip from current recording (like stop but with more options)
|
|
226
152
|
program
|
|
227
153
|
.command('create')
|
|
@@ -230,7 +156,74 @@ program
|
|
|
230
156
|
.option('-d, --description [text]', 'Replay markdown body. This may also be piped in: `cat README.md | dashcam create`')
|
|
231
157
|
.option('--md', 'Returns code for a rich markdown image link.')
|
|
232
158
|
.option('-k, --project <project>', 'Project ID to publish to')
|
|
233
|
-
.action(
|
|
159
|
+
.action(async (options) => {
|
|
160
|
+
try {
|
|
161
|
+
// Check for piped input (description from stdin)
|
|
162
|
+
let description = options.description;
|
|
163
|
+
if (!description && !process.stdin.isTTY) {
|
|
164
|
+
const chunks = [];
|
|
165
|
+
for await (const chunk of process.stdin) {
|
|
166
|
+
chunks.push(chunk);
|
|
167
|
+
}
|
|
168
|
+
description = Buffer.concat(chunks).toString('utf-8');
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (!processManager.isRecordingActive()) {
|
|
172
|
+
console.log('No active recording to create clip from');
|
|
173
|
+
console.log('Start a recording first with "dashcam record" or "dashcam start"');
|
|
174
|
+
process.exit(0);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const activeStatus = processManager.getActiveStatus();
|
|
178
|
+
|
|
179
|
+
console.log('Creating clip from recording...');
|
|
180
|
+
|
|
181
|
+
const result = await processManager.stopActiveRecording();
|
|
182
|
+
|
|
183
|
+
if (!result) {
|
|
184
|
+
console.log('Failed to stop recording');
|
|
185
|
+
process.exit(1);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
console.log('Recording stopped successfully');
|
|
189
|
+
|
|
190
|
+
// Upload the recording
|
|
191
|
+
console.log('Uploading clip...');
|
|
192
|
+
try {
|
|
193
|
+
const uploadResult = await upload(result.outputPath, {
|
|
194
|
+
title: options.title || activeStatus?.options?.title || 'Dashcam Recording',
|
|
195
|
+
description: description || activeStatus?.options?.description,
|
|
196
|
+
project: options.project || options.k || activeStatus?.options?.project,
|
|
197
|
+
duration: result.duration,
|
|
198
|
+
clientStartDate: result.clientStartDate,
|
|
199
|
+
apps: result.apps,
|
|
200
|
+
icons: result.icons,
|
|
201
|
+
gifPath: result.gifPath,
|
|
202
|
+
snapshotPath: result.snapshotPath
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
// Output based on format option
|
|
206
|
+
if (options.md) {
|
|
207
|
+
const replayId = uploadResult.replay?.id;
|
|
208
|
+
const shareKey = uploadResult.shareLink.split('share=')[1];
|
|
209
|
+
console.log(`[](${uploadResult.shareLink})`);
|
|
210
|
+
console.log('');
|
|
211
|
+
console.log(`Watch [Dashcam - ${options.title || 'New Replay'}](${uploadResult.shareLink}) on Dashcam`);
|
|
212
|
+
} else {
|
|
213
|
+
console.log(uploadResult.shareLink);
|
|
214
|
+
}
|
|
215
|
+
} catch (uploadError) {
|
|
216
|
+
console.error('Upload failed:', uploadError.message);
|
|
217
|
+
console.log('Recording saved locally:', result.outputPath);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
process.exit(0);
|
|
221
|
+
} catch (error) {
|
|
222
|
+
logger.error('Error creating clip:', error);
|
|
223
|
+
console.error('Failed to create clip:', error.message);
|
|
224
|
+
process.exit(1);
|
|
225
|
+
}
|
|
226
|
+
});
|
|
234
227
|
|
|
235
228
|
// 'record' command - the main recording command with all options
|
|
236
229
|
program
|
|
@@ -317,75 +310,39 @@ program
|
|
|
317
310
|
program
|
|
318
311
|
.command('track')
|
|
319
312
|
.description('Add a logs config to Dashcam')
|
|
320
|
-
.option('--
|
|
321
|
-
.option('--
|
|
322
|
-
.option('--pattern <pattern>', 'Pattern to track (can be used multiple times)', (value, previous) => {
|
|
323
|
-
return previous ? previous.concat([value]) : [value];
|
|
324
|
-
})
|
|
325
|
-
.option('--web <pattern>', 'Web URL pattern to track (can use wildcards like *) - deprecated, use --type=web --pattern instead')
|
|
326
|
-
.option('--app <pattern>', 'Application file pattern to track (can use wildcards like *) - deprecated, use --type=application --pattern instead')
|
|
313
|
+
.option('--web <pattern>', 'Web URL pattern to track (can use wildcards like *)')
|
|
314
|
+
.option('--app <pattern>', 'Application file pattern to track (can use wildcards like *)')
|
|
327
315
|
.action(async (options) => {
|
|
328
316
|
try {
|
|
329
|
-
|
|
330
|
-
// New syntax: --name=social --type=web --pattern="*facebook.com*" --pattern="*twitter.com*"
|
|
331
|
-
// Old syntax: --web <pattern> --app <pattern>
|
|
332
|
-
|
|
333
|
-
if (options.type && options.pattern) {
|
|
334
|
-
// New syntax validation
|
|
335
|
-
if (!options.name) {
|
|
336
|
-
console.error('Error: --name is required when using --type and --pattern');
|
|
337
|
-
console.log('Example: dashcam track --name=social --type=web --pattern="*facebook.com*" --pattern="*twitter.com*"');
|
|
338
|
-
process.exit(1);
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
if (options.type !== 'web' && options.type !== 'application') {
|
|
342
|
-
console.error('Error: --type must be either "web" or "application"');
|
|
343
|
-
process.exit(1);
|
|
344
|
-
}
|
|
345
|
-
|
|
317
|
+
if (options.web) {
|
|
346
318
|
const config = {
|
|
347
|
-
name:
|
|
348
|
-
type:
|
|
349
|
-
patterns: options.
|
|
319
|
+
name: 'Web Pattern',
|
|
320
|
+
type: 'web',
|
|
321
|
+
patterns: [options.web],
|
|
350
322
|
enabled: true
|
|
351
323
|
};
|
|
352
324
|
|
|
353
325
|
await createPattern(config);
|
|
354
|
-
console.log(
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
} else if (options.web || options.app) {
|
|
358
|
-
// Old syntax for backward compatibility
|
|
359
|
-
if (options.web) {
|
|
360
|
-
const config = {
|
|
361
|
-
name: options.name || 'Web Pattern',
|
|
362
|
-
type: 'web',
|
|
363
|
-
patterns: [options.web],
|
|
364
|
-
enabled: true
|
|
365
|
-
};
|
|
366
|
-
|
|
367
|
-
await createPattern(config);
|
|
368
|
-
console.log('Web tracking pattern added successfully:', options.web);
|
|
369
|
-
}
|
|
326
|
+
console.log('Web tracking pattern added successfully:', options.web);
|
|
327
|
+
}
|
|
370
328
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
console.
|
|
385
|
-
console.log(' --web or --app (old syntax)');
|
|
329
|
+
if (options.app) {
|
|
330
|
+
const config = {
|
|
331
|
+
name: 'App Pattern',
|
|
332
|
+
type: 'application',
|
|
333
|
+
patterns: [options.app],
|
|
334
|
+
enabled: true
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
await createPattern(config);
|
|
338
|
+
console.log('Application tracking pattern added successfully:', options.app);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
if (!options.web && !options.app) {
|
|
342
|
+
console.error('Error: Must provide either --web or --app');
|
|
386
343
|
console.log('\nExamples:');
|
|
387
|
-
console.log(' dashcam track --name=social --type=web --pattern="*facebook.com*" --pattern="*twitter.com*"');
|
|
388
344
|
console.log(' dashcam track --web "*facebook.com*"');
|
|
345
|
+
console.log(' dashcam track --app "/var/log/app.log"');
|
|
389
346
|
process.exit(1);
|
|
390
347
|
}
|
|
391
348
|
|
|
@@ -690,14 +647,4 @@ program
|
|
|
690
647
|
}
|
|
691
648
|
});
|
|
692
649
|
|
|
693
|
-
// If no command specified, treat as create command
|
|
694
|
-
program.action((options, command) => {
|
|
695
|
-
// Merge global options with command options
|
|
696
|
-
const mergedOptions = {
|
|
697
|
-
...command.opts(),
|
|
698
|
-
...options
|
|
699
|
-
};
|
|
700
|
-
return createClipAction(mergedOptions);
|
|
701
|
-
});
|
|
702
|
-
|
|
703
650
|
program.parse();
|
package/package.json
CHANGED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
# Backward Compatibility Summary
|
|
2
|
-
|
|
3
|
-
This document confirms that `dashcam-cli-minimal` now supports all commands and arguments documented in the README.md.
|
|
4
|
-
|
|
5
|
-
## ✅ Implemented Commands
|
|
6
|
-
|
|
7
|
-
### `auth <api-key>`
|
|
8
|
-
Authenticate the dashcam desktop using a team's apiKey.
|
|
9
|
-
```bash
|
|
10
|
-
dashcam auth <api-key>
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
### `create [options]`
|
|
14
|
-
Create a clip from current recording and output the resulting url or markdown. This stops the current recording and uploads it.
|
|
15
|
-
```bash
|
|
16
|
-
# Start instant replay in background
|
|
17
|
-
dashcam start
|
|
18
|
-
|
|
19
|
-
# Later, create a clip from the recording
|
|
20
|
-
dashcam create
|
|
21
|
-
dashcam create -t "My New Title"
|
|
22
|
-
dashcam create --md
|
|
23
|
-
dashcam create -k wef8we72h23012j
|
|
24
|
-
dashcam create -d "Description text"
|
|
25
|
-
cat README.md | dashcam create
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
Options:
|
|
29
|
-
- `-t, --title <string>` - Title of the replay
|
|
30
|
-
- `-d, --description [text]` - Replay markdown body (supports piped input)
|
|
31
|
-
- `--md` - Returns rich markdown image link
|
|
32
|
-
- `-k, --project <project>` - Project ID to publish to
|
|
33
|
-
|
|
34
|
-
**Note:** `create` stops the current recording and creates a clip. It's similar to `stop` but focused on outputting URLs/markdown for integration with other tools.
|
|
35
|
-
|
|
36
|
-
### `record [options]`
|
|
37
|
-
Start a recording terminal to be included in your dashcam video recording.
|
|
38
|
-
```bash
|
|
39
|
-
dashcam record
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Options:
|
|
43
|
-
- `-t, --title <title>` - Title for the recording
|
|
44
|
-
- `-d, --description <description>` - Description for the recording
|
|
45
|
-
- `-p, --project <project>` - Project ID to upload to
|
|
46
|
-
- `-a, --audio` - Include audio
|
|
47
|
-
- `-f, --fps <fps>` - Frames per second
|
|
48
|
-
|
|
49
|
-
### `pipe`
|
|
50
|
-
Pipe command output to dashcam to be included in recorded video.
|
|
51
|
-
```bash
|
|
52
|
-
ping 1.1.1.1 | dashcam pipe
|
|
53
|
-
cat /var/log/system.log | dashcam pipe
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### `track [options]`
|
|
57
|
-
Add a logs config to Dashcam.
|
|
58
|
-
|
|
59
|
-
**New Syntax (matches README):**
|
|
60
|
-
```bash
|
|
61
|
-
dashcam track --name=social --type=web --pattern="*facebook.com*" --pattern="*twitter.com*"
|
|
62
|
-
dashcam track --name=app-logs --type=application --pattern="/var/log/*.log"
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
**Old Syntax (still supported):**
|
|
66
|
-
```bash
|
|
67
|
-
dashcam track --web "*facebook.com*"
|
|
68
|
-
dashcam track --app "/var/log/app.log"
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
Options:
|
|
72
|
-
- `--name <name>` - Name for the tracking configuration (required with new syntax)
|
|
73
|
-
- `--type <type>` - Type: "application" or "web" (required with new syntax)
|
|
74
|
-
- `--pattern <pattern>` - Pattern to track (can use multiple times)
|
|
75
|
-
- `--web <pattern>` - Web URL pattern (deprecated, use --type=web --pattern)
|
|
76
|
-
- `--app <pattern>` - Application file pattern (deprecated, use --type=application --pattern)
|
|
77
|
-
|
|
78
|
-
### `start`
|
|
79
|
-
Start instant replay recording on dashcam.
|
|
80
|
-
```bash
|
|
81
|
-
dashcam start
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### `stop`
|
|
85
|
-
Stop the current recording and upload.
|
|
86
|
-
```bash
|
|
87
|
-
dashcam stop
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
### `status`
|
|
91
|
-
Show current recording status.
|
|
92
|
-
```bash
|
|
93
|
-
dashcam status
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
## Examples from README
|
|
97
|
-
|
|
98
|
-
All examples from the README should now work:
|
|
99
|
-
|
|
100
|
-
### Basic usage
|
|
101
|
-
```bash
|
|
102
|
-
# Create a replay
|
|
103
|
-
dashcam create
|
|
104
|
-
# Returns: https://dashcam.io/replay/123?share=xyz
|
|
105
|
-
|
|
106
|
-
# With markdown output
|
|
107
|
-
dashcam create --md
|
|
108
|
-
|
|
109
|
-
# With title
|
|
110
|
-
dashcam create -t "My New Title"
|
|
111
|
-
|
|
112
|
-
# With project
|
|
113
|
-
dashcam create -k wef8we72h23012j
|
|
114
|
-
|
|
115
|
-
# Attach last 20 CLI commands
|
|
116
|
-
history -20 | dashcam create
|
|
117
|
-
|
|
118
|
-
# Attach a logfile
|
|
119
|
-
cat /var/log/system.log | dashcam create
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
### Tracking logs
|
|
123
|
-
```bash
|
|
124
|
-
# Track web URLs
|
|
125
|
-
dashcam track --name=social --type=web --pattern="*facebook.com*" --pattern="*twitter.com*"
|
|
126
|
-
|
|
127
|
-
# Track application files
|
|
128
|
-
dashcam track --name=app-logs --type=application --pattern="/var/log/*.log"
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
### Recording
|
|
132
|
-
```bash
|
|
133
|
-
# Start recording
|
|
134
|
-
dashcam record
|
|
135
|
-
|
|
136
|
-
# Pipe output into recording
|
|
137
|
-
ping 1.1.1.1 | dashcam pipe
|
|
138
|
-
|
|
139
|
-
# Stop recording
|
|
140
|
-
dashcam stop
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
### GitHub CLI integration
|
|
144
|
-
```bash
|
|
145
|
-
# Create GitHub issue with replay
|
|
146
|
-
gh issue create -w -t "Title" -b "`dashcam create --md`"
|
|
147
|
-
|
|
148
|
-
# With system logs
|
|
149
|
-
gh issue create -w -t "Title" -b "`cat /var/log/system.log | dashcam create --md`"
|
|
150
|
-
|
|
151
|
-
# Create PR with replay
|
|
152
|
-
gh pr create -w -t "Title" -b "`dashcam create --md`"
|
|
153
|
-
|
|
154
|
-
# Append to commit
|
|
155
|
-
git commit -am "`dashcam create`"
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
## Key Changes for Backward Compatibility
|
|
159
|
-
|
|
160
|
-
1. **Added `create` command** - Stops current recording and creates a clip with URL/markdown output
|
|
161
|
-
2. **Added `pipe` command** - Allows piping command output into recordings
|
|
162
|
-
3. **Added `start` command** - Simple way to start instant replay recording in background
|
|
163
|
-
4. **Updated `track` command** - Now supports both old syntax (--web, --app) and new syntax (--name, --type, --pattern)
|
|
164
|
-
5. **Updated descriptions** - Match README text exactly
|
|
165
|
-
6. **Updated `auth` parameter** - Changed from `<apiKey>` to `<api-key>` to match README
|
|
166
|
-
7. **Added `-k` alias** - For `--project` option in `create` command
|
|
167
|
-
8. **Shared implementation** - `create`, `record`, and `start` share common code to avoid duplication
|
|
168
|
-
|
|
169
|
-
## Migration Notes
|
|
170
|
-
|
|
171
|
-
- **`start`** - Starts instant replay recording in background (like desktop app's always-on recording)
|
|
172
|
-
- **`create`** - Stops the current recording and outputs URL/markdown (perfect for CI/CD, git hooks, GitHub CLI)
|
|
173
|
-
- **`record`** - Full-featured recording command with all options (terminal recording mode)
|
|
174
|
-
- **`stop`** - Similar to `create` but focused on stopping and uploading vs URL output
|
|
175
|
-
- Old `track` syntax still works for backward compatibility but new syntax is preferred
|
|
176
|
-
- All piped input examples from README are supported
|
|
177
|
-
- Can run just `dashcam` with options (defaults to `create` command)
|