Skip to content

Commit d34827c

Browse files
authored
Merge pull request #1 from lpgrd/develop
Release v1.0.2
2 parents 85334a1 + d9be1b2 commit d34827c

20 files changed

Lines changed: 2531 additions & 5961 deletions

.github/workflows/code-quality.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Code Quality Check
2+
3+
on:
4+
push:
5+
branches: [master]
6+
7+
jobs:
8+
quality-check:
9+
runs-on: ubuntu-latest
10+
name: Verify Code Quality & Build
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Node.js environment
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '20.x'
20+
cache: 'npm'
21+
22+
- name: Install project dependencies
23+
run: npm ci
24+
25+
- name: Verify code formatting (Prettier)
26+
run: npm run format:check
27+
28+
- name: Check code quality (ESLint)
29+
run: npm run lint
30+
31+
- name: Verify TypeScript types
32+
run: npm run typecheck
33+
34+
- name: Build production bundle
35+
run: npm run build

.github/workflows/publish.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Publish to npm
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
paths:
7+
- 'package.json'
8+
- 'src/**'
9+
- 'tsconfig.json'
10+
- 'tsup.config.ts'
11+
workflow_dispatch: # Allow manual trigger
12+
13+
permissions:
14+
contents: read
15+
id-token: write
16+
17+
jobs:
18+
check-version:
19+
name: Check Version
20+
runs-on: ubuntu-latest
21+
outputs:
22+
should-publish: ${{ steps.check.outputs.should-publish }}
23+
version: ${{ steps.check.outputs.version }}
24+
25+
steps:
26+
- name: Checkout code
27+
uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0 # Need full history to check tags
30+
31+
- name: Setup Node.js
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: '20.x'
35+
registry-url: 'https://registry.npmjs.org'
36+
37+
- name: Check if version should be published
38+
id: check
39+
run: |
40+
# Get the current version from package.json
41+
CURRENT_VERSION=$(node -p "require('./package.json').version")
42+
echo "Current version: $CURRENT_VERSION"
43+
44+
# Check if this version tag already exists
45+
if git tag -l "v$CURRENT_VERSION" | grep -q "v$CURRENT_VERSION"; then
46+
echo "Version v$CURRENT_VERSION already exists as git tag"
47+
echo "should-publish=false" >> $GITHUB_OUTPUT
48+
else
49+
echo "Version v$CURRENT_VERSION is new"
50+
echo "should-publish=true" >> $GITHUB_OUTPUT
51+
echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
52+
fi
53+
54+
publish:
55+
name: Publish to npm
56+
runs-on: ubuntu-latest
57+
needs: check-version
58+
if: needs.check-version.outputs.should-publish == 'true'
59+
60+
steps:
61+
- name: Checkout code
62+
uses: actions/checkout@v4
63+
64+
- name: Setup Node.js
65+
uses: actions/setup-node@v4
66+
with:
67+
node-version: '20.x'
68+
registry-url: 'https://registry.npmjs.org'
69+
70+
- name: Install dependencies
71+
run: npm ci
72+
73+
- name: Build project
74+
run: npm run build
75+
76+
- name: Publish to npm
77+
run: npm publish
78+
env:
79+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
80+
81+
notify-success:
82+
name: Notify Success
83+
runs-on: ubuntu-latest
84+
needs: [check-version, publish]
85+
if: success()
86+
87+
steps:
88+
- name: Success notification
89+
run: |
90+
echo "✅ Successfully published @loopgrid/gitm v${{ needs.check-version.outputs.version }} to npm!"
91+
echo "📦 View on npm: https://www.npmjs.com/package/@loopgrid/gitm"
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Pull Request Validation
2+
3+
on:
4+
pull_request:
5+
branches: [master]
6+
7+
jobs:
8+
validate-pr:
9+
runs-on: ubuntu-latest
10+
name: Validate Code Quality, Tests & Security
11+
12+
steps:
13+
- name: Checkout pull request
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Node.js environment
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '20.x'
20+
cache: 'npm'
21+
22+
- name: Install project dependencies
23+
run: npm ci
24+
25+
- name: Verify code formatting (Prettier)
26+
run: npm run format:check
27+
28+
- name: Check code quality (ESLint)
29+
run: npm run lint
30+
31+
- name: Verify TypeScript types
32+
run: npm run typecheck
33+
34+
- name: Build production bundle
35+
run: npm run build
36+
37+
- name: Run test suite
38+
run: npm run test
39+
40+
- name: Check for security vulnerabilities
41+
run: npm audit --audit-level=high

.github/workflows/release.yml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: Create Release PR
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version type (patch, minor, major)'
8+
required: true
9+
default: 'patch'
10+
type: choice
11+
options:
12+
- patch
13+
- minor
14+
- major
15+
16+
permissions:
17+
contents: write
18+
pull-requests: write
19+
20+
jobs:
21+
create-release-pr:
22+
name: Create Release PR
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- name: Checkout code
27+
uses: actions/checkout@v4
28+
with:
29+
token: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: Setup Node.js
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: '20.x'
35+
cache: 'npm'
36+
37+
- name: Configure Git
38+
run: |
39+
git config --global user.name "github-actions[bot]"
40+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
41+
42+
- name: Create release branch
43+
run: |
44+
git checkout -b release/v${{ github.run_number }}
45+
46+
- name: Bump version
47+
id: version
48+
run: |
49+
# Get current version
50+
CURRENT_VERSION=$(node -p "require('./package.json').version")
51+
echo "Current version: $CURRENT_VERSION"
52+
53+
# Bump version
54+
npm version ${{ github.event.inputs.version }} --no-git-tag-version
55+
56+
# Get new version
57+
NEW_VERSION=$(node -p "require('./package.json').version")
58+
echo "New version: $NEW_VERSION"
59+
echo "new-version=$NEW_VERSION" >> $GITHUB_OUTPUT
60+
61+
- name: Update CHANGELOG
62+
run: |
63+
# Create or update CHANGELOG.md
64+
if [ ! -f CHANGELOG.md ]; then
65+
echo "# Changelog" > CHANGELOG.md
66+
echo "" >> CHANGELOG.md
67+
fi
68+
69+
# Add new version entry at the top
70+
TEMP_FILE=$(mktemp)
71+
echo "# Changelog" > $TEMP_FILE
72+
echo "" >> $TEMP_FILE
73+
echo "## v${{ steps.version.outputs.new-version }} - $(date +%Y-%m-%d)" >> $TEMP_FILE
74+
echo "" >> $TEMP_FILE
75+
echo "### Changed" >> $TEMP_FILE
76+
echo "- Version bump from workflow" >> $TEMP_FILE
77+
echo "" >> $TEMP_FILE
78+
tail -n +2 CHANGELOG.md >> $TEMP_FILE
79+
mv $TEMP_FILE CHANGELOG.md
80+
81+
- name: Commit changes
82+
run: |
83+
git add package.json package-lock.json CHANGELOG.md
84+
git commit -m "chore: bump version to v${{ steps.version.outputs.new-version }}"
85+
86+
- name: Push branch
87+
run: |
88+
git push -u origin release/v${{ github.run_number }}
89+
90+
- name: Create Pull Request
91+
uses: actions/github-script@v7
92+
with:
93+
script: |
94+
const { data: pr } = await github.rest.pulls.create({
95+
owner: context.repo.owner,
96+
repo: context.repo.repo,
97+
title: `Release v${{ steps.version.outputs.new-version }}`,
98+
body: `## 🚀 Release v${{ steps.version.outputs.new-version }}
99+
100+
This PR was automatically created to release version v${{ steps.version.outputs.new-version }}.
101+
102+
### Checklist
103+
- [ ] Update CHANGELOG.md with actual changes
104+
- [ ] Review version bump is correct
105+
- [ ] All tests are passing
106+
107+
### What happens when merged
108+
When this PR is merged to \`master\`:
109+
1. The npm publish workflow will automatically trigger
110+
2. The package will be published to npm
111+
112+
---
113+
_Created by release workflow_`,
114+
head: `release/v${{ github.run_number }}`,
115+
base: 'master',
116+
draft: false
117+
});
118+
119+
console.log(`Pull request created: ${pr.html_url}`);

.npmignore

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Development files
2+
src/
3+
*.ts
4+
!*.d.ts
5+
tsconfig.json
6+
tsup.config.ts
7+
tsup.config.prod.ts
8+
.eslintrc.json
9+
.prettierrc
10+
11+
# Testing
12+
tests/
13+
coverage/
14+
*.test.ts
15+
*.spec.ts
16+
vitest.config.ts
17+
18+
# Git and CI
19+
.git/
20+
.github/
21+
.gitignore
22+
23+
# IDE
24+
.vscode/
25+
.idea/
26+
*.swp
27+
*.swo
28+
29+
# Logs and temp files
30+
*.log
31+
npm-debug.log*
32+
yarn-debug.log*
33+
yarn-error.log*
34+
.DS_Store
35+
36+
# Documentation source files
37+
docs/
38+
*.md
39+
!README.md
40+
41+
# Build artifacts
42+
*.map
43+
.cache/
44+
tmp/
45+
46+
# Development dependencies
47+
node_modules/
48+
.env
49+
.env.*

CHANGELOG.md

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,39 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

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

1010
### Added
11-
- Initial release of gitm
12-
- Multi-account management for GitHub, GitLab, and Bitbucket
11+
- Initial release of `gitm`
12+
- Multi-account management for `GitHub`, `GitLab`, and `Bitbucket`
1313
- Automatic SSH key generation and management
1414
- Smart account detection based on repository URL
15-
- Commands: add, list, use, init, clone, remove, status, auth, verify
15+
- Commands: `add`, `list`, `use`, `init`, `clone`, `remove`, `status`, `auth`, `verify`
1616
- TypeScript implementation with full type safety
1717
- Security-focused design with command injection protection
1818
- Interactive authentication setup with persistent state
19-
- Support for both HTTPS and SSH workflows
20-
- Comprehensive documentation and examples
19+
- Support for both `HTTPS` and `SSH` workflows
20+
- Comprehensive documentation and examples
21+
22+
## [1.0.2] - 2025-07-02
23+
24+
### Added
25+
- Windows compatibility support
26+
- SSH tools availability checking with platform-specific installation instructions
27+
- Windows-specific documentation in README with setup guides
28+
- Platform-aware error messages for SSH agent issues
29+
- Build-time version injection to eliminate runtime package.json dependencies
30+
- `.npmignore` file to reduce published package size
31+
32+
### Changed
33+
- SSH config file permissions (`chmod`) now only applied on Unix-like systems
34+
- Hardcoded Unix paths (`~/.ssh`) replaced with platform-aware paths using `path.join()`
35+
- Package scripts cleaned up and consolidated
36+
- Updated build configuration `tsup.config.ts` to reduce the build size
37+
38+
### Fixed
39+
- Version mismatch between `gitm -V` and package.json
40+
41+
### Removed
42+
- Code coverage dependencies and scripts (`vitest coverage`, `c8`, `jest`)
43+
- Duplicate npm scripts (consolidated lint/format variants)

0 commit comments

Comments
 (0)