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
35 changes: 35 additions & 0 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Code Quality Check

on:
push:
branches: [master]

jobs:
quality-check:
runs-on: ubuntu-latest
name: Verify Code Quality & Build

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'

- name: Install project dependencies
run: npm ci

- name: Verify code formatting (Prettier)
run: npm run format:check

- name: Check code quality (ESLint)
run: npm run lint

- name: Verify TypeScript types
run: npm run typecheck

- name: Build production bundle
run: npm run build
91 changes: 91 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Publish to npm

on:
push:
branches: [ master ]
paths:
- 'package.json'
- 'src/**'
- 'tsconfig.json'
- 'tsup.config.ts'
workflow_dispatch: # Allow manual trigger

permissions:
contents: read
id-token: write

jobs:
check-version:
name: Check Version
runs-on: ubuntu-latest
outputs:
should-publish: ${{ steps.check.outputs.should-publish }}
version: ${{ steps.check.outputs.version }}

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Need full history to check tags

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'

- name: Check if version should be published
id: check
run: |
# Get the current version from package.json
CURRENT_VERSION=$(node -p "require('./package.json').version")
echo "Current version: $CURRENT_VERSION"

# Check if this version tag already exists
if git tag -l "v$CURRENT_VERSION" | grep -q "v$CURRENT_VERSION"; then
echo "Version v$CURRENT_VERSION already exists as git tag"
echo "should-publish=false" >> $GITHUB_OUTPUT
else
echo "Version v$CURRENT_VERSION is new"
echo "should-publish=true" >> $GITHUB_OUTPUT
echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
fi

publish:
name: Publish to npm
runs-on: ubuntu-latest
needs: check-version
if: needs.check-version.outputs.should-publish == 'true'

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: npm ci

- name: Build project
run: npm run build

- name: Publish to npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

notify-success:
name: Notify Success
runs-on: ubuntu-latest
needs: [check-version, publish]
if: success()

steps:
- name: Success notification
run: |
echo "✅ Successfully published @loopgrid/gitm v${{ needs.check-version.outputs.version }} to npm!"
echo "📦 View on npm: https://www.npmjs.com/package/@loopgrid/gitm"
41 changes: 41 additions & 0 deletions .github/workflows/pull-request-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Pull Request Validation

on:
pull_request:
branches: [master]

jobs:
validate-pr:
runs-on: ubuntu-latest
name: Validate Code Quality, Tests & Security

steps:
- name: Checkout pull request
uses: actions/checkout@v4

- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'

- name: Install project dependencies
run: npm ci

- name: Verify code formatting (Prettier)
run: npm run format:check

- name: Check code quality (ESLint)
run: npm run lint

- name: Verify TypeScript types
run: npm run typecheck

- name: Build production bundle
run: npm run build

- name: Run test suite
run: npm run test

- name: Check for security vulnerabilities
run: npm audit --audit-level=high
119 changes: 119 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: Create Release PR

on:
workflow_dispatch:
inputs:
version:
description: 'Version type (patch, minor, major)'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major

permissions:
contents: write
pull-requests: write

jobs:
create-release-pr:
name: Create Release PR
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'

- name: Configure Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"

- name: Create release branch
run: |
git checkout -b release/v${{ github.run_number }}

- name: Bump version
id: version
run: |
# Get current version
CURRENT_VERSION=$(node -p "require('./package.json').version")
echo "Current version: $CURRENT_VERSION"

# Bump version
npm version ${{ github.event.inputs.version }} --no-git-tag-version

# Get new version
NEW_VERSION=$(node -p "require('./package.json').version")
echo "New version: $NEW_VERSION"
echo "new-version=$NEW_VERSION" >> $GITHUB_OUTPUT

- name: Update CHANGELOG
run: |
# Create or update CHANGELOG.md
if [ ! -f CHANGELOG.md ]; then
echo "# Changelog" > CHANGELOG.md
echo "" >> CHANGELOG.md
fi

# Add new version entry at the top
TEMP_FILE=$(mktemp)
echo "# Changelog" > $TEMP_FILE
echo "" >> $TEMP_FILE
echo "## v${{ steps.version.outputs.new-version }} - $(date +%Y-%m-%d)" >> $TEMP_FILE
echo "" >> $TEMP_FILE
echo "### Changed" >> $TEMP_FILE
echo "- Version bump from workflow" >> $TEMP_FILE
echo "" >> $TEMP_FILE
tail -n +2 CHANGELOG.md >> $TEMP_FILE
mv $TEMP_FILE CHANGELOG.md

- name: Commit changes
run: |
git add package.json package-lock.json CHANGELOG.md
git commit -m "chore: bump version to v${{ steps.version.outputs.new-version }}"

- name: Push branch
run: |
git push -u origin release/v${{ github.run_number }}

- name: Create Pull Request
uses: actions/github-script@v7
with:
script: |
const { data: pr } = await github.rest.pulls.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: `Release v${{ steps.version.outputs.new-version }}`,
body: `## 🚀 Release v${{ steps.version.outputs.new-version }}

This PR was automatically created to release version v${{ steps.version.outputs.new-version }}.

### Checklist
- [ ] Update CHANGELOG.md with actual changes
- [ ] Review version bump is correct
- [ ] All tests are passing

### What happens when merged
When this PR is merged to \`master\`:
1. The npm publish workflow will automatically trigger
2. The package will be published to npm

---
_Created by release workflow_`,
head: `release/v${{ github.run_number }}`,
base: 'master',
draft: false
});

console.log(`Pull request created: ${pr.html_url}`);
49 changes: 49 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Development files
src/
*.ts
!*.d.ts
tsconfig.json
tsup.config.ts
tsup.config.prod.ts
.eslintrc.json
.prettierrc

# Testing
tests/
coverage/
*.test.ts
*.spec.ts
vitest.config.ts

# Git and CI
.git/
.github/
.gitignore

# IDE
.vscode/
.idea/
*.swp
*.swo

# Logs and temp files
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.DS_Store

# Documentation source files
docs/
*.md
!README.md

# Build artifacts
*.map
.cache/
tmp/

# Development dependencies
node_modules/
.env
.env.*
35 changes: 29 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,39 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.0] - 2024-12-30
## [1.0.1] - 2025-07-01

### Added
- Initial release of gitm
- Multi-account management for GitHub, GitLab, and Bitbucket
- Initial release of `gitm`
- Multi-account management for `GitHub`, `GitLab`, and `Bitbucket`
- Automatic SSH key generation and management
- Smart account detection based on repository URL
- Commands: add, list, use, init, clone, remove, status, auth, verify
- Commands: `add`, `list`, `use`, `init`, `clone`, `remove`, `status`, `auth`, `verify`
- TypeScript implementation with full type safety
- Security-focused design with command injection protection
- Interactive authentication setup with persistent state
- Support for both HTTPS and SSH workflows
- Comprehensive documentation and examples
- Support for both `HTTPS` and `SSH` workflows
- Comprehensive documentation and examples

## [1.0.2] - 2025-07-02

### Added
- Windows compatibility support
- SSH tools availability checking with platform-specific installation instructions
- Windows-specific documentation in README with setup guides
- Platform-aware error messages for SSH agent issues
- Build-time version injection to eliminate runtime package.json dependencies
- `.npmignore` file to reduce published package size

### Changed
- SSH config file permissions (`chmod`) now only applied on Unix-like systems
- Hardcoded Unix paths (`~/.ssh`) replaced with platform-aware paths using `path.join()`
- Package scripts cleaned up and consolidated
- Updated build configuration `tsup.config.ts` to reduce the build size

### Fixed
- Version mismatch between `gitm -V` and package.json

### Removed
- Code coverage dependencies and scripts (`vitest coverage`, `c8`, `jest`)
- Duplicate npm scripts (consolidated lint/format variants)
Loading
Loading