diff --git a/.github/workflows/cli-build.yml b/.github/workflows/cli-build.yml index 4fbe752..213ac1c 100644 --- a/.github/workflows/cli-build.yml +++ b/.github/workflows/cli-build.yml @@ -36,9 +36,14 @@ permissions: jobs: build-and-validate: runs-on: ubuntu-latest +<<<<<<< copilot/create-npx-package-for-token-analysis + env: + node-version: 22 +======= strategy: matrix: node-version: [18, 20, 22] +>>>>>>> main steps: - name: Harden Runner uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0 @@ -47,10 +52,17 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 +<<<<<<< copilot/create-npx-package-for-token-analysis + - name: Setup Node.js ${{ env.node-version }} + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + with: + node-version: ${{ env.node-version }} +======= - name: Setup Node.js ${{ matrix.node-version }} uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: node-version: ${{ matrix.node-version }} +>>>>>>> main - name: Install extension dependencies run: npm ci @@ -87,6 +99,13 @@ jobs: working-directory: cli run: node dist/cli.js fluency --tips +<<<<<<< copilot/create-npx-package-for-token-analysis + - name: Validate diagnostics command + working-directory: cli + run: node dist/cli.js diagnostics + +======= +>>>>>>> main - name: Build production bundle working-directory: cli run: npm run build:production diff --git a/.github/workflows/cli-publish.yml b/.github/workflows/cli-publish.yml index d349d95..ddca581 100644 --- a/.github/workflows/cli-publish.yml +++ b/.github/workflows/cli-publish.yml @@ -18,11 +18,22 @@ on: default: false type: boolean + push: + #branches: + # - main + paths: + - '.github/workflows/cli-publish.yml' + - 'cli/package.json' + - 'cli/package-lock.json' + permissions: contents: write + pull-requests: write + id-token: write # Required for OIDC to npm registry jobs: publish: + name: Publish CLI to npm runs-on: ubuntu-latest defaults: run: @@ -33,15 +44,13 @@ jobs: with: egress-policy: audit - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - token: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@v6 #v6 - name: Setup Node.js - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + uses: actions/setup-node@v6 #v6 with: - node-version: 20 - registry-url: https://registry.npmjs.org + node-version: 24 + registry-url: 'https://registry.npmjs.org' - name: Install extension dependencies run: npm ci @@ -65,25 +74,29 @@ jobs: - name: Publish to npm if: ${{ !inputs.dry_run }} - run: npm publish --access public - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: NODE_AUTH_TOKEN="" npm publish - name: Dry run publish if: ${{ inputs.dry_run }} - run: npm publish --access public --dry-run - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: NODE_AUTH_TOKEN="" npm publish public --dry-run - - name: Commit version bump + - name: Commit version bump and create PR if: ${{ !inputs.dry_run }} run: | cd .. git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git checkout -b cli/bump-version-v${{ steps.version.outputs.version }} git add cli/package.json cli/package-lock.json git commit -m "chore(cli): bump version to v${{ steps.version.outputs.version }}" - git push + git push origin cli/bump-version-v${{ steps.version.outputs.version }} + gh pr create \ + --title "chore(cli): bump version to v${{ steps.version.outputs.version }}" \ + --body "Automated version bump after publishing \`@rajbos/ai-engineering-fluency@${{ steps.version.outputs.version }}\` to npm." \ + --base main \ + --head cli/bump-version-v${{ steps.version.outputs.version }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Summary run: | @@ -94,5 +107,7 @@ jobs: echo "- **Dry run:** ${{ inputs.dry_run }}" >> "$GITHUB_STEP_SUMMARY" echo "" >> "$GITHUB_STEP_SUMMARY" if [ "${{ inputs.dry_run }}" = "false" ]; then - echo "Install with: \`npx copilot-token-tracker-cli\`" >> "$GITHUB_STEP_SUMMARY" + echo "Install with: \`npx @rajbos/ai-engineering-fluency\`" >> "$GITHUB_STEP_SUMMARY" + echo "" >> "$GITHUB_STEP_SUMMARY" + echo "A PR has been opened to merge the version bump back to main." >> "$GITHUB_STEP_SUMMARY" fi diff --git a/cli/package.json b/cli/package.json index cb63e86..849b5fb 100644 --- a/cli/package.json +++ b/cli/package.json @@ -1,12 +1,12 @@ { "name": "@rajbos/ai-engineering-fluency", - "version": "0.0.1", + "version": "0.0.2", "description": "AI Engineering Fluency - CLI tool to analyze GitHub Copilot token usage from local session files", "license": "MIT", "author": "RobBos", "repository": { "type": "git", - "url": "https://github.com/rajbos/github-copilot-token-usage", + "url": "git+https://github.com/rajbos/github-copilot-token-usage.git", "directory": "cli" }, "keywords": [ @@ -17,7 +17,7 @@ "token-tracker" ], "bin": { - "copilot-token-tracker": "./dist/cli.js" + "ai-engineering-fluency": "dist/cli.js" }, "files": [ "dist/**/*" @@ -38,6 +38,6 @@ "sql.js": "^1.12.0" }, "engines": { - "node": ">=18.0.0" + "node": ">=22.14.0" } }