Skip to content

Commit 007407b

Browse files
Copilotwarengonzaga
andcommitted
🔧 update: fix linting issues and update tests
Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com>
1 parent b3ca054 commit 007407b

20 files changed

Lines changed: 744 additions & 621 deletions

.github/funding.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@
55

66
github: warengonzaga
77
buy_me_a_coffee: warengonzaga
8-
98
# Your support means a lot to me to continue the development of open source project like this.
10-
# Sponsoring this project means a lot to me. Your support helps me to continue building great open-source projects just like this.
9+
# Sponsoring this project means a lot to me. Your support helps me to continue building great open-source projects just like this.

.github/instructions/copilot.instructions.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
applyTo: "**"
2+
applyTo: '**'
33
---
44

55
# Clean Commit Workflow
@@ -17,17 +17,17 @@ Reference: https://github.com/wgtechlabs/clean-commit
1717

1818
## The 9 Types
1919

20-
| Emoji | Type | What it covers |
21-
|:-----:|------|----------------|
22-
| 📦 | `new` | Adding new features, files, or capabilities |
23-
| 🔧 | `update` | Changing existing code, refactoring, improvements |
24-
| 🗑️ | `remove` | Removing code, files, features, or dependencies |
25-
| 🔒 | `security` | Security fixes, patches, vulnerability resolutions |
26-
| ⚙️ | `setup` | Project configs, CI/CD, tooling, build systems |
27-
| | `chore` | Maintenance tasks, dependency updates, housekeeping |
28-
| 🧪 | `test` | Adding, updating, or fixing tests |
29-
| 📖 | `docs` | Documentation changes and updates |
30-
| 🚀 | `release` | Version releases and release preparation |
20+
| Emoji | Type | What it covers |
21+
| :---: | ---------- | --------------------------------------------------- |
22+
| 📦 | `new` | Adding new features, files, or capabilities |
23+
| 🔧 | `update` | Changing existing code, refactoring, improvements |
24+
| 🗑️ | `remove` | Removing code, files, features, or dependencies |
25+
| 🔒 | `security` | Security fixes, patches, vulnerability resolutions |
26+
| ⚙️ | `setup` | Project configs, CI/CD, tooling, build systems |
27+
| | `chore` | Maintenance tasks, dependency updates, housekeeping |
28+
| 🧪 | `test` | Adding, updating, or fixing tests |
29+
| 📖 | `docs` | Documentation changes and updates |
30+
| 🚀 | `release` | Version releases and release preparation |
3131

3232
## Rules
3333

AGENTS.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ Reference: https://github.com/wgtechlabs/clean-commit
1313

1414
## The 9 Types
1515

16-
| Emoji | Type | What it covers |
17-
|:-----:|------|----------------|
18-
| 📦 | `new` | Adding new features, files, or capabilities |
19-
| 🔧 | `update` | Changing existing code, refactoring, improvements |
20-
| 🗑️ | `remove` | Removing code, files, features, or dependencies |
21-
| 🔒 | `security` | Security fixes, patches, vulnerability resolutions |
22-
| ⚙️ | `setup` | Project configs, CI/CD, tooling, build systems |
23-
| | `chore` | Maintenance tasks, dependency updates, housekeeping |
24-
| 🧪 | `test` | Adding, updating, or fixing tests |
25-
| 📖 | `docs` | Documentation changes and updates |
26-
| 🚀 | `release` | Version releases and release preparation |
16+
| Emoji | Type | What it covers |
17+
| :---: | ---------- | --------------------------------------------------- |
18+
| 📦 | `new` | Adding new features, files, or capabilities |
19+
| 🔧 | `update` | Changing existing code, refactoring, improvements |
20+
| 🗑️ | `remove` | Removing code, files, features, or dependencies |
21+
| 🔒 | `security` | Security fixes, patches, vulnerability resolutions |
22+
| ⚙️ | `setup` | Project configs, CI/CD, tooling, build systems |
23+
| | `chore` | Maintenance tasks, dependency updates, housekeeping |
24+
| 🧪 | `test` | Adding, updating, or fixing tests |
25+
| 📖 | `docs` | Documentation changes and updates |
26+
| 🚀 | `release` | Version releases and release preparation |
2727

2828
## Rules
2929

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ This project is inspired by the following projects:
6161
- [aicommits](https://github.com/Nutlope/aicommits) - A CLI that writes your git commit messages for you with AI.
6262
- [ai-commit](https://github.com/insulineru/ai-commit) - Make commits easier with ChatGPT, Gitmoji and Conventional Commits.
6363
- [opencommit](https://github.com/di-sukharev/opencommit) - About
64-
Auto-generate impressive commits with AI in 1 second.
64+
Auto-generate impressive commits with AI in 1 second.
6565
- [tgpt](https://github.com/aandrew-me/tgpt) - AI Chatbots in terminal without needing API keys.
6666
6767
## ⚙️ Project Activity
6868
69-
![activity](https://repobeats.axiom.co/api/embed/b89d4c52ac63656f8148143516edd0db0d85788d.svg "Repobeats analytics image")
69+
![activity](https://repobeats.axiom.co/api/embed/b89d4c52ac63656f8148143516edd0db0d85788d.svg 'Repobeats analytics image')
7070
7171
## 🎯 Contributing
7272

code_of_conduct.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,23 @@ diverse, inclusive, and healthy community.
1717
Examples of behavior that contributes to a positive environment for our
1818
community include:
1919

20-
* Demonstrating empathy and kindness toward other people
21-
* Being respectful of differing opinions, viewpoints, and experiences
22-
* Giving and gracefully accepting constructive feedback
23-
* Accepting responsibility and apologizing to those affected by our mistakes,
20+
- Demonstrating empathy and kindness toward other people
21+
- Being respectful of differing opinions, viewpoints, and experiences
22+
- Giving and gracefully accepting constructive feedback
23+
- Accepting responsibility and apologizing to those affected by our mistakes,
2424
and learning from the experience
25-
* Focusing on what is best not just for us as individuals, but for the
25+
- Focusing on what is best not just for us as individuals, but for the
2626
overall community
2727

2828
Examples of unacceptable behavior include:
2929

30-
* The use of sexualized language or imagery, and sexual attention or
30+
- The use of sexualized language or imagery, and sexual attention or
3131
advances of any kind
32-
* Trolling, insulting or derogatory comments, and personal or political attacks
33-
* Public or private harassment
34-
* Publishing others' private information, such as a physical or email
32+
- Trolling, insulting or derogatory comments, and personal or political attacks
33+
- Public or private harassment
34+
- Publishing others' private information, such as a physical or email
3535
address, without their explicit permission
36-
* Other conduct which could reasonably be considered inappropriate in a
36+
- Other conduct which could reasonably be considered inappropriate in a
3737
professional setting
3838

3939
## Enforcement Responsibilities
@@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban.
106106
### 4. Permanent Ban
107107

108108
**Community Impact**: Demonstrating a pattern of violation of community
109-
standards, including sustained inappropriate behavior, harassment of an
109+
standards, including sustained inappropriate behavior, harassment of an
110110
individual, or aggression toward or disparagement of classes of individuals.
111111

112112
**Consequence**: A permanent ban from any sort of public interaction within

contributing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ There are many ways to contribute to this open source project. Any contributions
1212

1313
### 🧬 Development
1414

15-
If you can write a code then create a pull request to this repo and I will review your code. Please consider to submit your pull request to the ```dev``` branch. I will auto reject if you submit your pull request to the ```main``` branch.
15+
If you can write a code then create a pull request to this repo and I will review your code. Please consider to submit your pull request to the `dev` branch. I will auto reject if you submit your pull request to the `main` branch.
1616

1717
#### 🔧 Setup
1818

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@
6363
}
6464
},
6565
"xo": {
66-
"prettier": true
66+
"prettier": true,
67+
"rules": {
68+
"unicorn/expiring-todo-comments": "off",
69+
"unicorn/no-process-exit": "off"
70+
}
6771
},
6872
"prettier": "@vdemedes/prettier-config",
6973
"babel": {

source/cli.js

Lines changed: 79 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,121 +1,121 @@
11
#!/usr/bin/env node
2+
import process from 'node:process';
23
import {Command} from 'commander';
4+
import packageJSON from '../package.json';
35
import {showBanner, showWarning} from './utils/ui.js';
46
import {commitCommand} from './commands/commit.js';
57
import {
6-
authenticateWithCopilot,
7-
authenticateWithOpenAI,
8-
showAuthStatusCommand,
9-
logout,
8+
authenticateWithCopilot,
9+
authenticateWithOpenAI,
10+
showAuthStatusCommand,
11+
logout,
1012
} from './commands/auth.js';
1113
import {showConfig, resetConfig} from './commands/config.js';
12-
import packageJSON from '../package.json';
1314

1415
const program = new Command();
1516

1617
// Setup program metadata
1718
program
18-
.name('magicc')
19-
.description('🪄 You can do magicc, you can build anything that you desire.')
20-
.version(packageJSON.version);
19+
.name('magicc')
20+
.description('🪄 You can do magicc, you can build anything that you desire.')
21+
.version(packageJSON.version);
2122

2223
// Show banner on startup (except for --help and --version)
23-
const args = process.argv.slice(2);
24-
if (!args.includes('--help') && !args.includes('-h') &&
25-
!args.includes('--version') && !args.includes('-V')) {
26-
showBanner();
24+
const args = new Set(process.argv.slice(2));
25+
if (
26+
!args.has('--help') &&
27+
!args.has('-h') &&
28+
!args.has('--version') &&
29+
!args.has('-V')
30+
) {
31+
showBanner();
2732
}
2833

2934
// Default command (commit)
30-
program
31-
.action(() => {
32-
// If no command is specified, run commit
33-
commitCommand();
35+
program.action(() => {
36+
// If no command is specified, run commit
37+
commitCommand();
3438
});
3539

3640
// Commit command
37-
const commitCmd = program
38-
.command('commit', {isDefault: false})
39-
.description('Generate AI-powered commit messages')
40-
.option('--all', 'Process all files at once')
41-
.option('--file <path>', 'Process specific file')
42-
.option('--model <model>', 'Specify AI model (e.g., gpt-4, gpt-3.5-turbo)')
43-
.action((options) => {
44-
commitCommand(options);
45-
});
41+
program
42+
.command('commit', {isDefault: false})
43+
.description('Generate AI-powered commit messages')
44+
.option('--all', 'Process all files at once')
45+
.option('--file <path>', 'Process specific file')
46+
.option('--model <model>', 'Specify AI model (e.g., gpt-4, gpt-3.5-turbo)')
47+
.action(options => {
48+
commitCommand(options);
49+
});
4650

4751
// Auth command
48-
const authCmd = program
49-
.command('auth')
50-
.description('Manage authentication');
52+
const authCmd = program.command('auth').description('Manage authentication');
5153

5254
authCmd
53-
.command('copilot')
54-
.description('Authenticate with GitHub Copilot')
55-
.option('--token <token>', 'GitHub token')
56-
.action((options) => {
57-
authenticateWithCopilot(options.token);
58-
});
55+
.command('copilot')
56+
.description('Authenticate with GitHub Copilot')
57+
.option('--token <token>', 'GitHub token')
58+
.action(options => {
59+
authenticateWithCopilot(options.token);
60+
});
5961

6062
authCmd
61-
.command('openai <key>')
62-
.description('Authenticate with OpenAI (legacy)')
63-
.action((key) => {
64-
authenticateWithOpenAI(key);
65-
});
63+
.command('openai <key>')
64+
.description('Authenticate with OpenAI (legacy)')
65+
.action(key => {
66+
authenticateWithOpenAI(key);
67+
});
6668

6769
authCmd
68-
.command('status')
69-
.description('Show authentication status')
70-
.action(() => {
71-
showAuthStatusCommand();
72-
});
70+
.command('status')
71+
.description('Show authentication status')
72+
.action(() => {
73+
showAuthStatusCommand();
74+
});
7375

7476
authCmd
75-
.command('logout')
76-
.description('Clear all credentials')
77-
.action(() => {
78-
logout();
79-
});
77+
.command('logout')
78+
.description('Clear all credentials')
79+
.action(() => {
80+
logout();
81+
});
8082

8183
// Config command
82-
const configCmd = program
83-
.command('config')
84-
.description('Manage configuration');
84+
const configCmd = program.command('config').description('Manage configuration');
8585

8686
configCmd
87-
.option('--show', 'Show current configuration')
88-
.option('--reset', 'Reset configuration to defaults')
89-
.action((options) => {
90-
if (options.reset) {
91-
resetConfig();
92-
} else {
93-
showConfig();
94-
}
95-
});
87+
.option('--show', 'Show current configuration')
88+
.option('--reset', 'Reset configuration to defaults')
89+
.action(options => {
90+
if (options.reset) {
91+
resetConfig();
92+
} else {
93+
showConfig();
94+
}
95+
});
9696

9797
// Legacy flags support with deprecation warnings
9898
program
99-
.option('-s, --setopenai <key>', '[DEPRECATED] Set OpenAI API key')
100-
.option('-d, --delopenai', '[DEPRECATED] Delete OpenAI API key');
99+
.option('-s, --setopenai <key>', '[DEPRECATED] Set OpenAI API key')
100+
.option('-d, --delopenai', '[DEPRECATED] Delete OpenAI API key');
101101

102102
// Handle legacy flags
103-
program.hook('preAction', (thisCommand) => {
104-
const options = thisCommand.opts();
105-
106-
if (options.setopenai) {
107-
showWarning('The -s flag is deprecated. Use: magicc auth openai <key>');
108-
console.log('');
109-
authenticateWithOpenAI(options.setopenai);
110-
process.exit(0);
111-
}
112-
113-
if (options.delopenai) {
114-
showWarning('The -d flag is deprecated. Use: magicc auth logout');
115-
console.log('');
116-
logout();
117-
process.exit(0);
118-
}
103+
program.hook('preAction', thisCommand => {
104+
const options = thisCommand.opts();
105+
106+
if (options.setopenai) {
107+
showWarning('The -s flag is deprecated. Use: magicc auth openai <key>');
108+
console.log('');
109+
authenticateWithOpenAI(options.setopenai);
110+
process.exit(0);
111+
}
112+
113+
if (options.delopenai) {
114+
showWarning('The -d flag is deprecated. Use: magicc auth logout');
115+
console.log('');
116+
logout();
117+
process.exit(0);
118+
}
119119
});
120120

121121
// Parse arguments

0 commit comments

Comments
 (0)