vibe_coding_tracker 2.2.2

Vibe Coding Tracker - AI coding assistant telemetry/usage parser, aggregate local session data into CodeAnalysis results
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
name: Build and Release

on:
  push:
    tags:
      - v*

permissions: write-all

concurrency:
  group: ${{ github.workflow }}
  cancel-in-progress: true

jobs:
  build:
    name: ${{ matrix.runner }} - ${{ matrix.target }}
    runs-on: ${{ matrix.runner }}

    timeout-minutes: 30

    strategy:
      fail-fast: false
      matrix:
        include:
          - runner: macos-14
            target: aarch64-apple-darwin
            friendly_id: macos-arm64
          - runner: macos-14
            target: x86_64-apple-darwin
            friendly_id: macos-x64
          - runner: ubuntu-24.04
            target: x86_64-unknown-linux-gnu
            friendly_id: linux-x64-gnu
          - runner: ubuntu-24.04-arm
            target: aarch64-unknown-linux-gnu
            friendly_id: linux-arm64-gnu
          - runner: windows-latest
            target: x86_64-pc-windows-msvc
            friendly_id: windows-x64
          - runner: windows-11-arm
            target: aarch64-pc-windows-msvc
            friendly_id: windows-arm64

    steps:
      - name: Checkout
        uses: actions/checkout@v7
        with:
          fetch-depth: 0
          token: ${{ secrets.GITHUB_TOKEN }}

      - name: Setup Rust Toolchain
        uses: actions-rust-lang/setup-rust-toolchain@v1.17.0
        with:
          target: ${{ matrix.target }}
          cache: false

      - name: Exclude build dirs from Windows Defender
        if: ${{ startsWith(matrix.runner, 'windows') }}
        shell: powershell
        run: |
          Add-MpPreference -ExclusionPath "${{ github.workspace }}" -ErrorAction SilentlyContinue
          Add-MpPreference -ExclusionPath "$env:USERPROFILE\.cargo" -ErrorAction SilentlyContinue
          Add-MpPreference -ExclusionProcess "rustc.exe" -ErrorAction SilentlyContinue
          Add-MpPreference -ExclusionProcess "link.exe" -ErrorAction SilentlyContinue

      - name: Cargo build (release)
        run: |
          cargo build --profile dist --locked --target ${{ matrix.target }} --bin vibe_coding_tracker

      - name: Stage Artifact
        shell: bash
        run: |
          set -euo pipefail
          dest="dist/${{ matrix.target }}"
          mkdir -p "$dest"
          bin_dir="target/${{ matrix.target }}/dist"
          bin="vibe_coding_tracker"
          if [[ "${{ matrix.runner }}" == windows* ]]; then
            bin="${bin}.exe"
          fi
          # Copy only the binary to avoid uploading sidecar files like *.d
          cp "${bin_dir}/${bin}" "${dest}/${bin}"

      - name: Create .zip (Windows)
        if: ${{ startsWith(matrix.runner, 'windows') }}
        shell: powershell
        run: |
          $ErrorActionPreference = "Stop"
          $dest = "dist/${{ matrix.target }}"
          $version = "${env:GITHUB_REF_NAME}".Substring(1)
          $bin = "vibe_coding_tracker.exe"
          $zip = "vibe_coding_tracker-v$version-${{ matrix.friendly_id }}.zip"
          Compress-Archive -Path "$dest\$bin" -DestinationPath "$dest\$zip" -Force

      - name: Create .tar.gz (all platforms)
        if: ${{ !startsWith(matrix.runner, 'windows') }}
        shell: bash
        run: |
          set -euo pipefail
          dest="dist/${{ matrix.target }}"
          version="${GITHUB_REF_NAME#v}"
          bin="vibe_coding_tracker"
          archive="vibe_coding_tracker-v${version}-${{ matrix.friendly_id }}.tar.gz"
          tar -C "$dest" -czf "$dest/${archive}" "${bin}" "${bin}.exe" 2>/dev/null || \
          tar -C "$dest" -czf "$dest/${archive}" "${bin}"
          rm -f "$dest/${bin}" "$dest/${bin}.exe" || true

      - name: Upload Artifacts
        uses: actions/upload-artifact@v7
        with:
          name: ${{ matrix.friendly_id }}
          path: dist/${{ matrix.target }}/*
          if-no-files-found: error
          retention-days: 7
          compression-level: 6
          overwrite: true

  package:
    name: Package Crate
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v7
        with:
          fetch-depth: 0
          token: ${{ secrets.GITHUB_TOKEN }}

      - name: Setup Rust Toolchain
        uses: actions-rust-lang/setup-rust-toolchain@v1.17.0
        with:
          cache: false

      - name: Derive version from tag and update Cargo.toml
        id: version
        shell: bash
        run: |
          TAG="${GITHUB_REF_NAME}"
          VERSION="${TAG#v}"
          echo "Version from tag: ${VERSION}"
          cargo install cargo-edit --locked
          cargo set-version "${VERSION}"
          echo "version=${VERSION}" >> $GITHUB_OUTPUT

      - name: Build crate package (.crate)
        run: |
          cargo package --locked --allow-dirty

      - name: Publish to crates.io
        continue-on-error: true
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
        run: |
          cargo publish --allow-dirty

      - name: Upload .crate artifact
        uses: actions/upload-artifact@v7
        with:
          path: target/package/*.crate
          name: crate
          if-no-files-found: ignore
          retention-days: 7
          compression-level: 6
          overwrite: true

  release:
    name: Create GitHub Release
    needs:
      - build
      - package
    runs-on: ubuntu-latest

    steps:
      - name: Download artifacts
        uses: actions/download-artifact@v8
        with:
          path: dist
          merge-multiple: true

      - name: List downloaded artifacts
        run: |
          echo "Downloaded artifact contents:"
          ls -alR dist

      - name: Upload Release Assets
        uses: softprops/action-gh-release@v3
        with:
          files: |
            dist/**/*

  publish-npm:
    name: Publish to npm - ${{ matrix.scope && format('{0}/', matrix.scope) || '' }}${{ matrix.name }}
    needs: build
    runs-on: ubuntu-latest

    permissions:
      contents: read
      id-token: write

    strategy:
      matrix:
        include:
          - name: vibe-coding-tracker
            scope: "@mai0313"
          - name: vct
            scope: "@mai0313"
          - name: vibe-coding-tracker
            scope: ""

    steps:
      - name: Checkout
        uses: actions/checkout@v7
        with:
          fetch-depth: 0
          token: ${{ secrets.GITHUB_TOKEN }}

      - name: Setup Node.js
        uses: actions/setup-node@v7
        with:
          node-version: lts/*

      - name: Extract version from tag
        id: version
        run: |
          VERSION="${GITHUB_REF_NAME#v}"
          echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
          echo "Publishing version: ${VERSION}"

      - name: Download and extract build artifacts
        uses: actions/download-artifact@v8
        with:
          path: cli/nodejs/binaries/temp
          merge-multiple: true

      - name: Extract binaries from archives
        working-directory: cli/nodejs/binaries/temp
        run: |
          for archive in *; do
            platform=$(echo "$archive" | sed -E 's/^vibe_coding_tracker-v[0-9]+\.[0-9]+\.[0-9]+-//')
            platform="${platform%.tar.gz}"
            platform="${platform%.zip}"

            echo "Extracting $archive to $platform/"
            mkdir -p "../$platform"

            case "$archive" in
              *.tar.gz) tar -xzf "$archive" -C "../$platform" ;;
              *.zip)    unzip -q "$archive" -d "../$platform" ;;
            esac
          done

      - name: Cleanup and verify
        run: |
          rm -rf cli/nodejs/binaries/temp
          echo "Extracted binaries:" && ls -lhR cli/nodejs/binaries/

      - name: Update package.json version and name
        working-directory: cli/nodejs
        run: |
          VERSION="${{ steps.version.outputs.VERSION }}"
          PACKAGE_NAME="${{ matrix.name }}"
          SCOPE="${{ matrix.scope }}"

          # Update version
          npm version ${VERSION} --no-git-tag-version

          # Update package name with scope if present
          if [ -n "${SCOPE}" ]; then
            FULL_NAME="${SCOPE}/${PACKAGE_NAME}"
          else
            FULL_NAME="${PACKAGE_NAME}"
          fi

          # Use jq to update package name
          cat package.json | jq --arg name "${FULL_NAME}" '.name = $name' > package.json.tmp
          mv package.json.tmp package.json

      - name: Copy README for npm
        run: |
          cp README.md cli/nodejs/README.md
          cp README.zh-CN.md cli/nodejs/README.zh-CN.md
          cp README.zh-TW.md cli/nodejs/README.zh-TW.md

      - name: Publish to npm
        working-directory: cli/nodejs
        run: |
          npm publish --access public

      - name: Verify publication
        working-directory: cli/nodejs
        run: |
          VERSION="${{ steps.version.outputs.VERSION }}"
          PACKAGE_NAME="${{ matrix.name }}"
          SCOPE="${{ matrix.scope }}"

          if [ -n "${SCOPE}" ]; then
            FULL_NAME="${SCOPE}/${PACKAGE_NAME}"
          else
            FULL_NAME="${PACKAGE_NAME}"
          fi

          echo "Waiting for npm registry to update..."
          sleep 10

          # Check if version is available
          PUBLISHED_VERSION=$(npm view ${FULL_NAME}@${VERSION} version 2>/dev/null || echo "")

          if [ "${PUBLISHED_VERSION}" = "${VERSION}" ]; then
            echo "✓ Successfully published ${FULL_NAME}@${VERSION}"
            echo "Install with: npm install -g ${FULL_NAME}"
          else
            echo "Warning: Could not immediately verify publication"
            echo "Please check: https://www.npmjs.com/package/${FULL_NAME}"
          fi

  publish-pypi:
    name: Publish to pypi
    needs: build
    runs-on: ubuntu-latest

    permissions:
      id-token: write

    steps:
      - name: Checkout
        uses: actions/checkout@v7
        with:
          fetch-depth: 0
          token: ${{ secrets.GITHUB_TOKEN }}

      - name: Setup uv
        uses: astral-sh/setup-uv@v7
        with:
          version: "latest"
          github-token: ${{ secrets.GITHUB_TOKEN }}

      - name: Extract version from tag
        id: version
        run: |
          VERSION="${GITHUB_REF_NAME#v}"
          echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
          echo "Publishing version: ${VERSION}"

      - name: Download and extract build artifacts
        uses: actions/download-artifact@v8
        with:
          path: cli/python/src/vibe_coding_tracker/binaries/temp
          merge-multiple: true

      - name: Extract binaries from archives
        working-directory: cli/python/src/vibe_coding_tracker/binaries/temp
        run: |
          for archive in *; do
            platform=$(echo "$archive" | sed -E 's/^vibe_coding_tracker-v[0-9]+\.[0-9]+\.[0-9]+-//')
            platform="${platform%.tar.gz}"
            platform="${platform%.zip}"

            echo "Extracting $archive to $platform/"
            mkdir -p "../$platform"

            case "$archive" in
              *.tar.gz) tar -xzf "$archive" -C "../$platform" ;;
              *.zip)    unzip -q "$archive" -d "../$platform" ;;
            esac
          done

      - name: Cleanup and verify
        run: |
          rm -rf cli/python/src/vibe_coding_tracker/binaries/temp
          echo "Extracted binaries:" && ls -lhR cli/python/src/vibe_coding_tracker/binaries/

      - name: Update pyproject.toml version
        working-directory: cli/python
        run: |
          uv version ${{ steps.version.outputs.VERSION }} --frozen

      - name: Copy README for PyPI
        run: |
          cp README.md cli/python/README.md
          cp README.zh-CN.md cli/python/README.zh-CN.md
          cp README.zh-TW.md cli/python/README.zh-TW.md

      - name: Build package
        working-directory: cli/python
        run: |
          uv build

      - name: Publish to PyPI
        working-directory: cli/python
        env:
          UV_PUBLISH_TOKEN: ${{ secrets.UV_PUBLISH_TOKEN }}
        run: |
          uv publish

      - name: Verify publication
        working-directory: cli/python
        run: |
          VERSION="${{ steps.version.outputs.VERSION }}"
          PACKAGE_NAME="vibe_coding_tracker"

          echo "Waiting for PyPI registry to update..."
          sleep 15

          # Check if version is available
          PUBLISHED_VERSION=$(pip index versions ${PACKAGE_NAME} 2>/dev/null | grep "Available versions:" | grep -o "${VERSION}" || echo "")

          if [ "${PUBLISHED_VERSION}" = "${VERSION}" ]; then
            echo "✓ Successfully published ${PACKAGE_NAME}==${VERSION}"
            echo "Install with: pip install ${PACKAGE_NAME}"
          else
            echo "Warning: Could not immediately verify publication"
            echo "Please check: https://pypi.org/project/${PACKAGE_NAME}/"
          fi