Skip to content

Commit 8d7970a

Browse files
committed
feat(github): add CODEOWNERS and version check workflow; update README and setup.py
1 parent 74ece2b commit 8d7970a

4 files changed

Lines changed: 153 additions & 45 deletions

File tree

.github/CODEOWNERS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# These owners will be the default owners for everything in the repo
2+
* @SingularityX-ai
3+
4+
# Critical files that require special attention
5+
setup.py @ss.sumansaurabh92
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Version Check and Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'setup.py'
9+
10+
jobs:
11+
check-version-and-release:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v3
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v4
24+
with:
25+
python-version: '3.x'
26+
27+
- name: Extract version from setup.py
28+
id: extract_version
29+
run: |
30+
VERSION=$(grep -oP "version=[\"']\K[^\"']+" setup.py)
31+
echo "Current version: $VERSION"
32+
echo "VERSION=$VERSION" >> $GITHUB_ENV
33+
34+
- name: Get latest release
35+
id: latest_release
36+
uses: pozetroninc/github-action-get-latest-release@master
37+
with:
38+
repository: ${{ github.repository }}
39+
excludes: prerelease, draft
40+
continue-on-error: true
41+
42+
- name: Compare versions
43+
id: compare_versions
44+
run: |
45+
LATEST_VERSION="${{ steps.latest_release.outputs.release }}"
46+
LATEST_VERSION=${LATEST_VERSION#v}
47+
48+
echo "Latest released version: $LATEST_VERSION"
49+
echo "Current setup.py version: $VERSION"
50+
51+
if [ -z "$LATEST_VERSION" ] || [ "$LATEST_VERSION" != "$VERSION" ]; then
52+
echo "NEW_RELEASE=true" >> $GITHUB_ENV
53+
else
54+
echo "NEW_RELEASE=false" >> $GITHUB_ENV
55+
fi
56+
57+
- name: Generate release notes
58+
if: env.NEW_RELEASE == 'true'
59+
id: generate_notes
60+
uses: actions/github-script@v6
61+
with:
62+
script: |
63+
const { data: commits } = await github.rest.repos.listCommits({
64+
owner: context.repo.owner,
65+
repo: context.repo.repo,
66+
per_page: 10
67+
});
68+
69+
let releaseNotes = "## What's Changed\n\n";
70+
commits.forEach(commit => {
71+
releaseNotes += `* ${commit.commit.message} by @${commit.author ? commit.author.login : 'unknown'}\n`;
72+
});
73+
74+
return releaseNotes;
75+
76+
- name: Create Release
77+
if: env.NEW_RELEASE == 'true'
78+
uses: ncipollo/release-action@v1
79+
with:
80+
tag: v${{ env.VERSION }}
81+
name: Release v${{ env.VERSION }}
82+
body: ${{ steps.generate_notes.outputs.result }}
83+
draft: false
84+
prerelease: false
85+
token: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 62 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Penify CLI Tool
22

3-
A CLI tool to generate Documentation, Commit-summary, and more.
3+
A CLI tool to generate smart commit messages, code documentation, and more.
44

55
## Installation
66

@@ -12,90 +12,108 @@ pip install penifycli
1212

1313
## Usage
1414

15-
Penify CLI provides several subcommands for different functionalities:
15+
Penify CLI provides several subcommands for different functionalities, organized into basic commands (no login required) and advanced commands (login required).
1616

17-
### Login
17+
## Basic Commands (No login required)
1818

19-
To log in and obtain an API token:
19+
### Commit
20+
21+
Generate smart commit messages using local LLM:
2022

2123
```bash
22-
penifycli login
24+
penifycli commit [-m "Optional message"] [-e] [-d]
2325
```
2426

25-
This command will open a browser window for authentication. After successful login, the API key will be saved locally for future use.
27+
Options:
28+
- `-m, --message`: Optional custom commit message
29+
- `-e, --terminal`: Open editor to modify commit message before committing
30+
- `-d, --description`: Generate commit message with both title and description (without this flag, only title is generated)
2631

27-
### Install Git Hook
32+
### Config
2833

29-
To install the Git post-commit hook:
34+
Configure local LLM and JIRA settings:
3035

3136
```bash
32-
penifycli install-hook -l /path/to/git/repo
33-
```
37+
# Configure LLM settings
38+
penifycli config llm --model MODEL_NAME [--api-base API_URL] [--api-key API_KEY]
3439

35-
- `-l, --location`: The path to the Git repository where you want to install the hook.
40+
# Configure LLM settings through web interface
41+
penifycli config llm-web
3642

37-
### Uninstall Git Hook
43+
# Configure JIRA settings
44+
penifycli config jira --url JIRA_URL --username USERNAME --api-token TOKEN [--verify]
3845

39-
To uninstall the Git post-commit hook:
40-
41-
```bash
42-
penifycli uninstall-hook -l /path/to/git/repo
46+
# Configure JIRA settings through web interface
47+
penifycli config jira-web
4348
```
4449

45-
- `-l, --location`: The path to the Git repository from which you want to uninstall the hook.
50+
## Advanced Commands (Login required)
4651

47-
### Generate Documentation
52+
### Login
4853

49-
To generate documentation for files or folders:
54+
To log in and obtain an API token:
5055

5156
```bash
52-
penifycli docgen [options]
57+
penifycli login
5358
```
5459

55-
Options:
56-
- `-fl, --file_path`: Path to a specific file for which to generate documentation.
57-
- `-cf, --complete_folder_path`: Path to a folder for which to generate documentation for all files.
58-
- `-gf, --git_folder_path`: Path to a Git repository to generate documentation for modified files. Defaults to the current directory.
60+
This command will open a browser window for authentication. After successful login, the API key will be saved locally for future use.
5961

60-
### Commit Code
62+
### Documentation Generation
6163

62-
To commit code with an automatically generated commit message:
64+
Generate documentation for Git diff, files or folders:
6365

6466
```bash
65-
penifycli commit -gf /path/to/git/repo [-m "Optional message"] [-e True/False]
67+
# Generate documentation for latest Git commit diff
68+
penifycli docgen
69+
70+
# Generate documentation for specific file or folder
71+
penifycli docgen -l /path/to/file/or/folder
6672
```
6773

68-
- `-gf, --git_folder_path`: Path to the Git repository. Defaults to the current directory.
69-
- `-m, --message`: Optional commit message. If not provided, a default message will be used.
70-
- `-e, --terminal`: Set to "True" to open the terminal for editing the commit message. Defaults to "False".
74+
Options:
75+
- `-l, --location`: Path to specific file or folder for documentation generation (defaults to current directory)
7176

72-
### JIRA Integration
77+
### Git Hook Management
7378

74-
To integrate with JIRA and automate issue tracking:
79+
Install or uninstall Git post-commit hooks:
7580

7681
```bash
77-
penifycli jira [options]
82+
# Install Git hook
83+
penifycli docgen install-hook [-l /path/to/repo]
84+
85+
# Uninstall Git hook
86+
penifycli docgen uninstall-hook [-l /path/to/repo]
7887
```
7988

8089
Options:
81-
- `-u, --url`: JIRA instance URL.
82-
- `-p, --project`: JIRA project key.
83-
- `-i, --issue`: JIRA issue key.
84-
- `-a, --assignee`: Assignee for the JIRA issue.
90+
- `-l, --location`: Path to the Git repository (defaults to current directory)
8591

8692
## Authentication
8793

88-
Penify CLI uses an API token for authentication. The token is obtained and used in the following priority:
94+
Penify CLI uses an API token for authentication with advanced features.
95+
96+
If no token is available and you try to access an advanced feature, you'll be prompted to log in.
97+
98+
## Local LLM Configuration
8999

90-
1. Command-line argument: `-t` or `--token`
91-
2. Environment variable: `PENIFY_API_TOKEN`
92-
3. Stored credentials: `~/.penify` file (created after successful login)
100+
For commit message generation, Penify can use a local LLM. Configure it using:
93101

94-
If no token is available, you'll be prompted to log in or provide a token.
102+
```bash
103+
penifycli config llm --model MODEL_NAME --api-base API_URL --api-key API_KEY
104+
```
105+
106+
Common configurations:
107+
- OpenAI: `--model gpt-3.5-turbo --api-base https://api.openai.com/v1 --api-key YOUR_KEY`
108+
- Anthropic: `--model claude-2 --api-base https://api.anthropic.com --api-key YOUR_KEY`
95109

96-
## Environment Variables
110+
## JIRA Integration
97111

98-
- `PENIFY_API_TOKEN`: You can set this environment variable with your API token to avoid passing it as an argument each time.
112+
Configure JIRA integration to enhance commit messages with issue details:
113+
114+
```bash
115+
penifycli config jira --url https://your-domain.atlassian.net --username your-email@example.com --api-token YOUR_API_TOKEN
116+
```
99117

100118
## Development
101119

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name="penifycli", # Changed from "penifycli" to a more unique name
5-
version="0.2.0",
5+
version="0.2.1",
66
packages=['penify_hook'],
77
install_requires=[
88
"requests",

0 commit comments

Comments
 (0)