dashcam 0.8.3 → 1.0.1-beta.10

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.
Files changed (55) hide show
  1. package/.dashcam/cli-config.json +3 -0
  2. package/.dashcam/recording.log +135 -0
  3. package/.dashcam/web-config.json +11 -0
  4. package/.github/RELEASE.md +59 -0
  5. package/.github/workflows/publish.yml +43 -0
  6. package/BACKWARD_COMPATIBILITY.md +177 -0
  7. package/LOG_TRACKING_GUIDE.md +225 -0
  8. package/README.md +709 -155
  9. package/bin/dashcam-background.js +177 -0
  10. package/bin/dashcam.cjs +8 -0
  11. package/bin/dashcam.js +696 -0
  12. package/bin/index.js +63 -0
  13. package/examples/execute-script.js +152 -0
  14. package/examples/simple-test.js +37 -0
  15. package/lib/applicationTracker.js +311 -0
  16. package/lib/auth.js +222 -0
  17. package/lib/binaries.js +21 -0
  18. package/lib/config.js +34 -0
  19. package/lib/extension-logs/helpers.js +182 -0
  20. package/lib/extension-logs/index.js +347 -0
  21. package/lib/extension-logs/manager.js +344 -0
  22. package/lib/ffmpeg.js +155 -0
  23. package/lib/logTracker.js +23 -0
  24. package/lib/logger.js +118 -0
  25. package/lib/logs/index.js +488 -0
  26. package/lib/permissions.js +85 -0
  27. package/lib/processManager.js +317 -0
  28. package/lib/recorder.js +690 -0
  29. package/lib/store.js +58 -0
  30. package/lib/tracking/FileTracker.js +105 -0
  31. package/lib/tracking/FileTrackerManager.js +62 -0
  32. package/lib/tracking/LogsTracker.js +161 -0
  33. package/lib/tracking/active-win.js +212 -0
  34. package/lib/tracking/icons/darwin.js +39 -0
  35. package/lib/tracking/icons/index.js +167 -0
  36. package/lib/tracking/icons/windows.js +27 -0
  37. package/lib/tracking/idle.js +82 -0
  38. package/lib/tracking.js +23 -0
  39. package/lib/uploader.js +456 -0
  40. package/lib/utilities/jsonl.js +77 -0
  41. package/lib/webLogsDaemon.js +234 -0
  42. package/lib/websocket/server.js +223 -0
  43. package/package.json +53 -21
  44. package/recording.log +814 -0
  45. package/sea-bundle.mjs +34595 -0
  46. package/test-page.html +15 -0
  47. package/test.log +1 -0
  48. package/test_run.log +48 -0
  49. package/test_workflow.sh +154 -0
  50. package/examples/crash-test.js +0 -11
  51. package/examples/github-issue.sh +0 -1
  52. package/examples/protocol.html +0 -22
  53. package/index.js +0 -177
  54. package/lib.js +0 -199
  55. package/recorder.js +0 -85
@@ -0,0 +1,3 @@
1
+ {
2
+ "/tmp/test-cli-log.txt": true
3
+ }
@@ -0,0 +1,135 @@
1
+ 23:53:59.852 [info] Started tracking logs for /tmp/test-cli-log.txt
2
+ 23:53:59.940 [info] Generated temp file path
3
+ 23:53:59.941 [info] Wrote temp file info to disk
4
+ 23:53:59.941 [info] Starting recording with options:
5
+ 23:53:59.961 [info] FFmpeg process spawned
6
+ Background recording started
7
+ Background recording started
8
+ 23:53:59.987 [info] Started tracking logs for /tmp/test-cli-log.txt
9
+ 23:53:59.987 [info] Started new logs tracker instance
10
+ 23:53:59.988 [info] Recording process started successfully
11
+ 23:53:59.988 [info] Background recording signal handlers registered
12
+ 23:53:59.995 [info] FFmpeg output: ffmpeg version 6.0 Copyright (c) 2000-2023 the FFmpeg developers
13
+ built with Apple clang version 13.1.6 (clang-1316.0.21.2.5)
14
+ configuration: --prefix=/Volumes/tempdisk/sw --extra-cflags=-fno-stack-check --arch=arm64 --cc=/usr/bin/clang --enable-gpl --enable-libvmaf --enable-libbluray --enable-libopenjpeg --enable-libopus --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libvpx --enable-libwebp --enable-libass --enable-libfreetype --enable-fontconfig --enable-libtheora --enable-libvorbis --enable-libsnappy --enable-libaom --enable-libvidstab --enable-libzimg --enable-libsvtav1 --enable-libkvazaar --enable-version3 --pkg-config-flags=--static --enable-ffplay --enable-postproc --enable-nonfree --enable-neon --enable-runtime-cpudetect --disable-indev=qtkit --disable-indev=x11grab_xcb
15
+ libavutil 58. 2.100 / 58. 2.100
16
+ libavcodec 60. 3.100 / 60. 3.100
17
+ libavformat 60. 3.100 / 60. 3.100
18
+ libavdevice 60. 1.100 / 60. 1.100
19
+ libavfilter 9. 3.100 / 9. 3.100
20
+ libswscale 7. 1.100 / 7. 1.100
21
+ libswresample 4. 10.100 / 4. 10.100
22
+ libpostproc 57. 1.100 / 57. 1.100
23
+ 23:54:00.583 [info] FFmpeg output: objc[43042]: class `NSKVONotifying_AVCaptureScreenInput' not linked into application
24
+ objc[43042]: class `NSKVONotifying_AVCaptureScreenInput' not linked into application
25
+ objc[43042]: class `NSKVONotifying_AVCaptureScreenInput' not linked into application
26
+ [AVFoundation indev @ 0x15bf04e90] Configuration of video device failed, falling back to default.
27
+ 23:54:00.584 [error] PERMISSION ISSUE DETECTED: Screen recording failed. This happens because the Node.js subprocess doesn't inherit VS Code's screen recording permissions.
28
+ 23:54:00.585 [error] SOLUTION: Add Node.js to screen recording permissions:
29
+ 23:54:00.585 [error] 1. Open System Preferences > Security & Privacy > Privacy > Screen Recording
30
+ 23:54:00.585 [error] 2. Click the lock to unlock
31
+ 23:54:00.585 [error] 3. Click the + button and add: /usr/local/bin/node (or your Node.js installation path)
32
+ 23:54:00.585 [error] 4. Alternatively, find node with: which node
33
+ 23:54:00.585 [error] 5. Restart the terminal after adding permissions
34
+ 23:54:02.962 [warn] Temp file not created yet
35
+ 23:54:05.323 [info] === STOP SIGNAL FILE DETECTED ===
36
+ 23:54:05.324 [info] === SHUTDOWN SIGNAL RECEIVED ===
37
+ Stopping background recording...
38
+ 23:54:05.325 [info] Background recording shutdown initiated
39
+ 23:54:05.325 [info] Stopping recording
40
+ 23:54:11.594 [info] Looking for temp file
41
+ DEBUG: Looking for temp file {
42
+ inMemory: '/Users/ianjennings/Development/dashcam-cli-minimal/tmp/recordings/temp-1761713639939.webm',
43
+ infoFileExists: true,
44
+ infoPath: '/Users/ianjennings/Development/dashcam-cli-minimal/.dashcam/temp-file.json'
45
+ }
46
+ 23:54:11.601 [info] Debug: temp file check
47
+ 23:54:11.606 [info] Enhanced application tracking stopped
48
+ 23:54:11.608 [error] Error in background recording: Recording file is empty or missing
49
+ Error in background recording: Recording file is empty or missing
50
+ 23:54:11.608 [info] Cleaning up background recording process
51
+ 23:54:36.456 [info] Started tracking logs for /tmp/test-cli-log.txt
52
+ 23:54:36.554 [info] Generated temp file path
53
+ 23:54:36.555 [info] Wrote temp file info to disk
54
+ 23:54:36.555 [info] Starting recording with options:
55
+ 23:54:36.578 [info] FFmpeg process spawned
56
+ Background recording started
57
+ Background recording started
58
+ 23:54:36.660 [info] Started tracking logs for /tmp/test-cli-log.txt
59
+ 23:54:36.661 [info] Started new logs tracker instance
60
+ 23:54:36.661 [info] Recording process started successfully
61
+ 23:54:36.661 [info] Background recording signal handlers registered
62
+ 23:54:36.673 [info] FFmpeg output: ffmpeg version 6.0 Copyright (c) 2000-2023 the FFmpeg developers
63
+ built with Apple clang version 13.1.6 (clang-1316.0.21.2.5)
64
+ configuration: --prefix=/Volumes/tempdisk/sw --extra-cflags=-fno-stack-check --arch=arm64 --cc=/usr/bin/clang --enable-gpl --enable-libvmaf --enable-libbluray --enable-libopenjpeg --enable-libopus --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libvpx --enable-libwebp --enable-libass --enable-libfreetype --enable-fontconfig --enable-libtheora --enable-libvorbis --enable-libsnappy --enable-libaom --enable-libvidstab --enable-libzimg --enable-libsvtav1 --enable-libkvazaar --enable-version3 --pkg-config-flags=--static --enable-ffplay --enable-postproc --enable-nonfree --enable-neon --enable-runtime-cpudetect --disable-indev=qtkit --disable-indev=x11grab_xcb
65
+ libavutil 58. 2.100 / 58. 2.100
66
+ libavcodec 60. 3.100 / 60. 3.100
67
+ libavformat 60. 3.100 / 60. 3.100
68
+ libavdevice 60. 1.100 / 60. 1.100
69
+ libavfilter 9. 3.100 / 9. 3.100
70
+ libswscale 7. 1.100 / 7. 1.100
71
+ libswresample 4. 10.100 / 4. 10.100
72
+ libpostproc 57. 1.100 / 57. 1.100
73
+ 23:54:37.202 [info] FFmpeg output: objc[43240]: class `NSKVONotifying_AVCaptureScreenInput' not linked into application
74
+ objc[43240]: class `NSKVONotifying_AVCaptureScreenInput' not linked into application
75
+ objc[43240]: class `NSKVONotifying_AVCaptureScreenInput' not linked into application
76
+ [AVFoundation indev @ 0x150904880] Configuration of video device failed, falling back to default.
77
+ 23:54:37.203 [error] PERMISSION ISSUE DETECTED: Screen recording failed. This happens because the Node.js subprocess doesn't inherit VS Code's screen recording permissions.
78
+ 23:54:37.204 [error] SOLUTION: Add Node.js to screen recording permissions:
79
+ 23:54:37.205 [error] 1. Open System Preferences > Security & Privacy > Privacy > Screen Recording
80
+ 23:54:37.205 [error] 2. Click the lock to unlock
81
+ 23:54:37.205 [error] 3. Click the + button and add: /usr/local/bin/node (or your Node.js installation path)
82
+ 23:54:37.205 [error] 4. Alternatively, find node with: which node
83
+ 23:54:37.240 [error] 5. Restart the terminal after adding permissions
84
+ 23:54:39.580 [warn] Temp file not created yet
85
+ 23:55:03.729 [warn] Failed to get active window
86
+ 23:55:07.654 [info] Started tracking logs for /tmp/test-cli-log.txt
87
+ 23:55:07.783 [info] Generated temp file path
88
+ 23:55:07.783 [info] Wrote temp file info to disk
89
+ 23:55:07.784 [info] Starting recording with options:
90
+ 23:55:07.801 [info] FFmpeg process spawned
91
+ Background recording started
92
+ Background recording started
93
+ 23:55:07.825 [info] Started tracking logs for /tmp/test-cli-log.txt
94
+ 23:55:07.825 [info] Started new logs tracker instance
95
+ 23:55:07.825 [info] Recording process started successfully
96
+ 23:55:07.826 [info] Background recording signal handlers registered
97
+ 23:55:07.835 [info] FFmpeg output: ffmpeg version 6.0 Copyright (c) 2000-2023 the FFmpeg developers
98
+ built with Apple clang version 13.1.6 (clang-1316.0.21.2.5)
99
+ configuration: --prefix=/Volumes/tempdisk/sw --extra-cflags=-fno-stack-check --arch=arm64 --cc=/usr/bin/clang --enable-gpl --enable-libvmaf --enable-libbluray --enable-libopenjpeg --enable-libopus --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libvpx --enable-libwebp --enable-libass --enable-libfreetype --enable-fontconfig --enable-libtheora --enable-libvorbis --enable-libsnappy --enable-libaom --enable-libvidstab --enable-libzimg --enable-libsvtav1 --enable-libkvazaar --enable-version3 --pkg-config-flags=--static --enable-ffplay --enable-postproc --enable-nonfree --enable-neon --enable-runtime-cpudetect --disable-indev=qtkit --disable-indev=x11grab_xcb
100
+ libavutil 58. 2.100 / 58. 2.100
101
+ libavcodec 60. 3.100 / 60. 3.100
102
+ libavformat 60. 3.100 / 60. 3.100
103
+ libavdevice 60. 1.100 / 60. 1.100
104
+ libavfilter 9. 3.100 / 9. 3.100
105
+ libswscale 7. 1.100 / 7. 1.100
106
+ libswresample 4. 10.100 / 4. 10.100
107
+ libpostproc 57. 1.100 / 57. 1.100
108
+ 23:55:08.365 [info] FFmpeg output: objc[43507]: class `NSKVONotifying_AVCaptureScreenInput' not linked into application
109
+ 23:55:08.367 [info] FFmpeg output: objc[43507]: class `NSKVONotifying_AVCaptureScreenInput' not linked into application
110
+ objc[43507]: class `NSKVONotifying_AVCaptureScreenInput' not linked into application
111
+ [AVFoundation indev @ 0x1522047a0] Configuration of video device failed, falling back to default.
112
+ 23:55:08.367 [error] PERMISSION ISSUE DETECTED: Screen recording failed. This happens because the Node.js subprocess doesn't inherit VS Code's screen recording permissions.
113
+ 23:55:08.367 [error] SOLUTION: Add Node.js to screen recording permissions:
114
+ 23:55:08.367 [error] 1. Open System Preferences > Security & Privacy > Privacy > Screen Recording
115
+ 23:55:08.368 [error] 2. Click the lock to unlock
116
+ 23:55:08.368 [error] 3. Click the + button and add: /usr/local/bin/node (or your Node.js installation path)
117
+ 23:55:08.368 [error] 4. Alternatively, find node with: which node
118
+ 23:55:08.368 [error] 5. Restart the terminal after adding permissions
119
+ 23:55:10.803 [warn] Temp file not created yet
120
+ 23:55:17.645 [info] === STOP SIGNAL FILE DETECTED ===
121
+ 23:55:17.646 [info] === SHUTDOWN SIGNAL RECEIVED ===
122
+ Stopping background recording...
123
+ 23:55:17.647 [info] Background recording shutdown initiated
124
+ 23:55:17.648 [info] Stopping recording
125
+ 23:55:23.673 [info] Looking for temp file
126
+ DEBUG: Looking for temp file {
127
+ inMemory: '/Users/ianjennings/Development/dashcam-cli-minimal/tmp/recordings/temp-1761713707782.webm',
128
+ infoFileExists: true,
129
+ infoPath: '/Users/ianjennings/Development/dashcam-cli-minimal/.dashcam/temp-file.json'
130
+ }
131
+ 23:55:23.676 [info] Debug: temp file check
132
+ 23:55:23.678 [info] Enhanced application tracking stopped
133
+ 23:55:23.679 [error] Error in background recording: Recording file is empty or missing
134
+ Error in background recording: Recording file is empty or missing
135
+ 23:55:23.680 [info] Cleaning up background recording process
@@ -0,0 +1,11 @@
1
+ {
2
+ "testdriver-tracking": {
3
+ "id": "testdriver-tracking",
4
+ "name": "testdriver-tracking",
5
+ "type": "web",
6
+ "enabled": true,
7
+ "patterns": [
8
+ "*testdriver.ai*"
9
+ ]
10
+ }
11
+ }
@@ -0,0 +1,59 @@
1
+ # Release Workflow
2
+
3
+ ## How It Works
4
+
5
+ ### Pull Requests
6
+ - When you create a PR, the build workflow runs automatically
7
+ - Binaries are built for all platforms but **NOT released**
8
+ - Artifacts are uploaded to the PR for testing
9
+
10
+ ### Pushes to Main
11
+ - When code is pushed to `main`, the release workflow automatically:
12
+ 1. **Bumps the version** (creates a git tag)
13
+ 2. **Builds binaries** for all platforms
14
+ 3. **Creates a GitHub release** with all binaries attached
15
+
16
+ ## Version Bumping
17
+
18
+ The version is automatically bumped based on your commit messages:
19
+
20
+ ### Default: Patch Version (1.0.0 → 1.0.1)
21
+ ```bash
22
+ git commit -m "fix: bug fix"
23
+ git commit -m "docs: update documentation"
24
+ ```
25
+
26
+ ### Minor Version (1.0.0 → 1.1.0)
27
+ Include `#minor` or `#feature` in your commit message:
28
+ ```bash
29
+ git commit -m "feat: add new feature #minor"
30
+ git commit -m "new feature #feature"
31
+ ```
32
+
33
+ ### Major Version (1.0.0 → 2.0.0)
34
+ Include `#major` in your commit message:
35
+ ```bash
36
+ git commit -m "breaking: major API change #major"
37
+ git commit -m "refactor: complete rewrite #major"
38
+ ```
39
+
40
+ ### Skip Release
41
+ Include `#none` or `[skip ci]` to skip the release:
42
+ ```bash
43
+ git commit -m "chore: update README #none"
44
+ git commit -m "docs: typo fix [skip ci]"
45
+ ```
46
+
47
+ ## Manual Release
48
+
49
+ You can trigger a release manually from the GitHub Actions tab:
50
+ 1. Go to Actions → Release workflow
51
+ 2. Click "Run workflow"
52
+ 3. Select the branch and run
53
+
54
+ ## Supported Platforms
55
+
56
+ Each release includes binaries for:
57
+ - **macOS**: x64 (Intel) and ARM64 (Apple Silicon)
58
+ - **Linux**: x64 and ARM64
59
+ - **Windows**: x64 and ARM64
@@ -0,0 +1,43 @@
1
+ name: Publish to npm
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ publish:
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ contents: write
13
+ id-token: write
14
+ steps:
15
+ - name: Checkout code
16
+ uses: actions/checkout@v4
17
+ with:
18
+ fetch-depth: 0
19
+ token: ${{ secrets.GITHUB_TOKEN }}
20
+
21
+ - name: Setup Node.js
22
+ uses: actions/setup-node@v4
23
+ with:
24
+ node-version: '20'
25
+ registry-url: 'https://registry.npmjs.org'
26
+
27
+ - name: Configure Git
28
+ run: |
29
+ git config user.name "github-actions[bot]"
30
+ git config user.email "github-actions[bot]@users.noreply.github.com"
31
+
32
+ - name: Bump version
33
+ run: |
34
+ npm version prerelease --preid=beta -m "chore: bump version to %s [skip ci]"
35
+
36
+ - name: Push changes
37
+ run: |
38
+ git push --follow-tags
39
+
40
+ - name: Publish to npm
41
+ run: npm publish --access public --tag beta
42
+ env:
43
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -0,0 +1,177 @@
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)
@@ -0,0 +1,225 @@
1
+ # Dashcam CLI - Log Tracking Guide
2
+
3
+ The Dashcam CLI can track both **file-based logs** (from CLI applications) and **web browser logs** (from browser extensions). This guide explains how to use the log tracking features.
4
+
5
+ ## File Log Tracking (CLI Applications)
6
+
7
+ ### Adding Log Files to Track
8
+
9
+ Track log files during recordings:
10
+
11
+ ```bash
12
+ # Add a single log file
13
+ dashcam logs --add /var/log/myapp.log
14
+
15
+ # Add multiple log files
16
+ dashcam logs --add /tmp/debug.log
17
+ dashcam logs --add ~/.npm/_logs/npm.log
18
+ dashcam logs --add /var/log/nginx/access.log
19
+ ```
20
+
21
+ ### Removing Log Files
22
+
23
+ ```bash
24
+ # Remove a log file from tracking
25
+ dashcam logs --remove /var/log/myapp.log
26
+ ```
27
+
28
+ ### Viewing Tracked Files
29
+
30
+ ```bash
31
+ # List all currently tracked log files
32
+ dashcam logs --list
33
+
34
+ # Show detailed tracking status
35
+ dashcam logs --status
36
+ ```
37
+
38
+ ## Web Browser Log Tracking
39
+
40
+ ### Setting Up Web App Tracking
41
+
42
+ Web log tracking requires configuring patterns for URLs you want to monitor:
43
+
44
+ ```bash
45
+ # Create a config file for web apps (web-logs.json)
46
+ cat > web-logs.json << 'EOF'
47
+ [
48
+ {
49
+ "id": "my-web-app",
50
+ "type": "web",
51
+ "name": "My Web Application",
52
+ "enabled": true,
53
+ "patterns": [
54
+ "*localhost:3000*",
55
+ "*myapp.com*",
56
+ "*staging.myapp.com*"
57
+ ]
58
+ },
59
+ {
60
+ "id": "github",
61
+ "type": "web",
62
+ "name": "GitHub",
63
+ "enabled": true,
64
+ "patterns": [
65
+ "*github.com*"
66
+ ]
67
+ }
68
+ ]
69
+ EOF
70
+ ```
71
+
72
+ ### Updating Web Log Configuration
73
+
74
+ ```javascript
75
+ // In your Node.js script or through the API
76
+ import { logsTrackerManager } from './lib/logs/index.js';
77
+
78
+ const webConfig = [
79
+ {
80
+ id: 'my-app',
81
+ type: 'web',
82
+ name: 'My Application',
83
+ enabled: true,
84
+ patterns: ['*localhost:3000*', '*myapp.com*']
85
+ }
86
+ ];
87
+
88
+ logsTrackerManager.updateLogsConfig(webConfig);
89
+ ```
90
+
91
+ ## Recording with Log Tracking
92
+
93
+ ### Start a Recording with Logs
94
+
95
+ ```bash
96
+ # Start recording (logs are automatically included if configured)
97
+ dashcam record --duration 30
98
+
99
+ # The recording will include:
100
+ # - All tracked log files (--add files above)
101
+ # - Web browser events (if browser extension is installed)
102
+ ```
103
+
104
+ ### Browser Extension Setup
105
+
106
+ 1. **Install the Dashcam browser extension** (Chrome/Firefox)
107
+ 2. **The CLI automatically starts a WebSocket server** on ports: 10368, 16240, 21855, 24301, or 25928
108
+ 3. **Extension connects automatically** when CLI is running
109
+ 4. **Web events are captured** based on your URL patterns
110
+
111
+ ## Log Event Types
112
+
113
+ ### File Logs
114
+ - **Line events**: Each new line written to tracked files
115
+ - **Timestamps**: Precise timing for synchronization with video
116
+ - **Error detection**: Automatic highlighting of error lines
117
+
118
+ ### Web Logs
119
+ - **Console logs**: `console.log()`, `console.error()`, etc.
120
+ - **Network requests**: HTTP requests and responses
121
+ - **Navigation events**: Page loads and URL changes
122
+ - **Tab management**: Tab switches and window focus
123
+
124
+ ## Example Workflow
125
+
126
+ ```bash
127
+ # 1. Add log files to track
128
+ dashcam logs --add /var/log/myapp.log
129
+ dashcam logs --add /tmp/debug.log
130
+
131
+ # 2. Check status
132
+ dashcam logs --status
133
+ # Output:
134
+ # Log tracking status:
135
+ # Active recording instances: 0
136
+ # Configured CLI log files: 2
137
+ # Total recent events: 15
138
+ # File tracker details:
139
+ # /var/log/myapp.log: 8 events (last minute)
140
+ # /tmp/debug.log: 7 events (last minute)
141
+
142
+ # 3. Start recording
143
+ dashcam record --duration 60
144
+
145
+ # 4. During recording:
146
+ # - CLI monitors all tracked log files in real-time
147
+ # - Browser extension sends web events via WebSocket
148
+ # - All events are timestamped and synchronized
149
+
150
+ # 5. After recording:
151
+ # - Logs are automatically trimmed to match video duration
152
+ # - Events are saved in JSONL format alongside video
153
+ # - Logs can be replayed in sync with video
154
+ ```
155
+
156
+ ## Advanced Configuration
157
+
158
+ ### Custom WebSocket Port
159
+
160
+ ```javascript
161
+ // If you need to use specific ports
162
+ import { server } from './lib/websocket/server.js';
163
+ await server.start(); // Uses predefined port list
164
+ ```
165
+
166
+ ### Pattern Matching for Web Apps
167
+
168
+ Patterns support wildcards:
169
+ - `*example.com*` - Matches any URL containing "example.com"
170
+ - `*localhost:3000*` - Matches local development server
171
+ - `*github.com/myuser/*` - Matches specific GitHub paths
172
+
173
+ ### Log File Requirements
174
+
175
+ - **Files must exist** before adding to tracking
176
+ - **Files must be readable** by the CLI process
177
+ - **Real-time writes** are monitored (uses `tail` library)
178
+ - **Log rotation** is automatically handled
179
+
180
+ ## Troubleshooting
181
+
182
+ ### Common Issues
183
+
184
+ 1. **"Log file does not exist"**
185
+ ```bash
186
+ # Ensure file exists first
187
+ touch /var/log/myapp.log
188
+ dashcam logs --add /var/log/myapp.log
189
+ ```
190
+
191
+ 2. **"WebSocket connection failed"**
192
+ - Check that browser extension is installed
193
+ - Verify no firewall blocking local ports
194
+ - Ensure CLI is running when opening browser
195
+
196
+ 3. **"No events captured"**
197
+ ```bash
198
+ # Check if files are being written to
199
+ tail -f /var/log/myapp.log
200
+
201
+ # Verify tracking status
202
+ dashcam logs --status
203
+ ```
204
+
205
+ ### Getting Help
206
+
207
+ ```bash
208
+ # Show all log tracking options
209
+ dashcam logs --help
210
+
211
+ # Show general CLI help
212
+ dashcam --help
213
+ ```
214
+
215
+ ## Integration with Recordings
216
+
217
+ When you create a recording, all configured logs are:
218
+
219
+ 1. **Automatically included** in the recording
220
+ 2. **Synchronized** with video timestamps
221
+ 3. **Trimmed** to match video start/end times
222
+ 4. **Saved** in JSON Lines format for replay
223
+ 5. **Uploaded** along with video files
224
+
225
+ The result is a complete recording with both visual and log context, making debugging and analysis much more effective.