Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/cli-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,14 @@
jobs:
build-and-validate:
runs-on: ubuntu-latest
<<<<<<< copilot/create-npx-package-for-token-analysis

Check failure on line 39 in .github/workflows/cli-build.yml

View workflow job for this annotation

GitHub Actions / run-actionlint

could not parse as YAML: could not find expected ':'

Check failure on line 39 in .github/workflows/cli-build.yml

View workflow job for this annotation

GitHub Actions / run-actionlint

could not parse as YAML: could not find expected ':'
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
Expand All @@ -47,10 +52,17 @@

- 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
Expand Down Expand Up @@ -87,6 +99,13 @@
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
Expand Down
45 changes: 30 additions & 15 deletions .github/workflows/cli-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,22 @@
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:
Expand All @@ -33,15 +44,13 @@
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
Expand All @@ -65,28 +74,32 @@

- 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: |

Check failure on line 102 in .github/workflows/cli-publish.yml

View workflow job for this annotation

GitHub Actions / run-actionlint

shellcheck reported issue in this script: SC2129:style:8:3: Consider using { cmd1; cmd2; } >> file instead of individual redirects

Check failure on line 102 in .github/workflows/cli-publish.yml

View workflow job for this annotation

GitHub Actions / run-actionlint

shellcheck reported issue in this script: SC2129:style:1:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects

Check failure on line 102 in .github/workflows/cli-publish.yml

View workflow job for this annotation

GitHub Actions / run-actionlint

shellcheck reported issue in this script: SC2129:style:8:3: Consider using { cmd1; cmd2; } >> file instead of individual redirects

Check failure on line 102 in .github/workflows/cli-publish.yml

View workflow job for this annotation

GitHub Actions / run-actionlint

shellcheck reported issue in this script: SC2129:style:1:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects
echo "## CLI Package Published 📦" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "- **Version:** v${{ steps.version.outputs.version }}" >> "$GITHUB_STEP_SUMMARY"
Expand All @@ -94,5 +107,7 @@
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
8 changes: 4 additions & 4 deletions cli/package.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand All @@ -17,7 +17,7 @@
"token-tracker"
],
"bin": {
"copilot-token-tracker": "./dist/cli.js"
"ai-engineering-fluency": "dist/cli.js"
},
"files": [
"dist/**/*"
Expand All @@ -38,6 +38,6 @@
"sql.js": "^1.12.0"
},
"engines": {
"node": ">=18.0.0"
"node": ">=22.14.0"
}
}
Loading