@denyhs/cortex-cli
Advanced tools
Comparing version 1.0.0-beta.1 to 1.0.0-beta.2
@@ -8,6 +8,11 @@ # Changelog | ||
## [1.0.0] - 2024-12-19 | ||
## [1.0.0-beta.2] - 2024-12-19 | ||
### Added | ||
- New `--stageAll` flag to automatically stage all changes before generating the commit message | ||
## [1.0.0-beta.1] - 2024-12-19 | ||
### Added | ||
- Initial release of the Cortex CLI tool | ||
@@ -14,0 +19,0 @@ - Core command `cortex commit-message` to generate commit messages |
{ | ||
"name": "@denyhs/cortex-cli", | ||
"version": "1.0.0-beta.1", | ||
"version": "1.0.0-beta.2", | ||
"description": "CLI tool to generate commit messages based on repository changes", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -37,2 +37,3 @@ # Cortex CLI | ||
- `--all`: Generate message for all changes (staged and unstaged) | ||
- `--stageAll`: Stage all changes before generating the message | ||
- `--header <text>`: Add a custom header to the commit message (will be added above the generated message) | ||
@@ -51,2 +52,11 @@ - `--commitStaged`: After generating the message, prompt to commit staged changes | ||
# Stage all changes and generate message | ||
cortex commit-message --stageAll | ||
# Stage all changes, generate message with header, and commit | ||
cortex commit-message --stageAll --header="feat: new feature implementation" --commitStaged | ||
# Stage all changes, generate message, and commit and push | ||
cortex commit-message --stageAll --commitAndPush | ||
# Generate message with a custom header | ||
@@ -57,5 +67,2 @@ cortex commit-message --header="feat: new feature implementation" | ||
cortex commit-message --commitAndPush --header="fix: resolve critical bug" | ||
# Generate message and commit if approved | ||
cortex commit-message --commitStaged | ||
``` | ||
@@ -67,2 +74,3 @@ | ||
- Supports different scopes of changes (staged, unstaged, or all) | ||
- Automatic staging of all changes | ||
- Copies generated message to clipboard | ||
@@ -69,0 +77,0 @@ - Optional custom header for commit messages |
@@ -5,2 +5,5 @@ import chalk from 'chalk'; | ||
const API_HOSTNAME = process.env.CORTEX_COMMIT_MESSAGES_API_HOSTNAME || 'http://localhost:5000'; | ||
const API_URL = `${API_HOSTNAME}/api/generate-commit-message`; | ||
const git = simpleGit(); | ||
@@ -32,4 +35,19 @@ | ||
async function stageAllChanges() { | ||
try { | ||
await git.add('.'); | ||
console.log(chalk.green('All changes have been staged.')); | ||
} catch (error) { | ||
console.error(chalk.red('Error staging changes:'), error.message); | ||
process.exit(1); | ||
} | ||
} | ||
async function getDiff(options) { | ||
try { | ||
// Stage all changes if requested | ||
if (options.stageAll) { | ||
await stageAllChanges(); | ||
} | ||
const status = await git.status(); | ||
@@ -68,3 +86,3 @@ | ||
try { | ||
const response = await fetch('http://localhost:5000/api/generate-commit-message', { | ||
const response = await fetch(API_URL, { | ||
method: 'POST', | ||
@@ -71,0 +89,0 @@ headers: { |
@@ -21,2 +21,3 @@ #!/usr/bin/env node | ||
.option('--all', 'Generate message for all changes (staged and unstaged)') | ||
.option('--stageAll', 'Stage all changes before generating the message') | ||
.option('--header <text>', 'Add a custom header to the commit message') | ||
@@ -23,0 +24,0 @@ .option('--commitStaged', 'Commit staged changes with the generated message') |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
10598
164
78
3