feat: restore g ls and g ll commands

- Add back separate g ls (short list) and g ll (detailed list) commands
- Keep g h as alias for g ls for backward compatibility
- Update documentation and quick help to show all three options
- Users now have: g ls, g ll, and g h for commit history
- Version bump to 0.6.3
This commit is contained in:
s41r4j
2025-10-10 11:10:05 +05:30
parent 6832a598cb
commit ce005adf22
4 changed files with 73 additions and 17 deletions
+6 -3
View File
@@ -8,7 +8,9 @@ g i # Interactive - Guided commit wizard
g p # Preview - See what will be committed g p # Preview - See what will be committed
g l # Local - AI commit locally g l # Local - AI commit locally
g o # Online - AI commit + push g o # Online - AI commit + push
g h # History - Numbered commit log g ls # List - Short commit history
g ll # Large List - Detailed commit history
g h # History - Alias for list
g a # Amend - Smart amend with AI g a # Amend - Smart amend with AI
g u # Undo - Undo last commit g u # Undo - Undo last commit
``` ```
@@ -37,8 +39,9 @@ g o # One-command: commit + push
g l # Local commit only g l # Local commit only
# 3. View history # 3. View history
g h # Recent commits g ls # Recent commits (short)
g h --detailed --limit 10 # Detailed view g ll # Recent commits (detailed)
g h # Same as g ls
``` ```
## Default AI Models ## Default AI Models
+4 -2
View File
@@ -32,7 +32,9 @@ g o # AI commit + push
| `g i` | Interactive commit wizard | | `g i` | Interactive commit wizard |
| `g o` | AI commit + push | | `g o` | AI commit + push |
| `g l` | AI commit locally | | `g l` | AI commit locally |
| `g h` | Commit history | | `g ls` | Commit history (short) |
| `g ll` | Commit history (detailed) |
| `g h` | Commit history (alias for ls) |
| `g a` | Smart amend | | `g a` | Smart amend |
## 🤖 AI Models ## 🤖 AI Models
@@ -51,7 +53,7 @@ g o # Quick commit + push
# Advanced # Advanced
g sg --multiple # Get 3 AI suggestions g sg --multiple # Get 3 AI suggestions
g h --detailed # Detailed history g ll # Detailed history
g sync --rebase # Smart sync g sync --rebase # Smart sync
``` ```
+62 -11
View File
@@ -308,7 +308,9 @@ program.command('help-quick').alias('q')
console.log(` ${color.cyan('g p')} Preview - See what will be committed`); console.log(` ${color.cyan('g p')} Preview - See what will be committed`);
console.log(` ${color.cyan('g l')} Local - AI commit locally`); console.log(` ${color.cyan('g l')} Local - AI commit locally`);
console.log(` ${color.cyan('g o')} Online - AI commit + push`); console.log(` ${color.cyan('g o')} Online - AI commit + push`);
console.log(` ${color.cyan('g h')} History - Numbered commit log`); console.log(` ${color.cyan('g ls')} List - Short commit history`);
console.log(` ${color.cyan('g ll')} Large List - Detailed commit history`);
console.log(` ${color.cyan('g h')} History - Alias for list`);
console.log(` ${color.cyan('g a')} Amend - Smart amend with AI`); console.log(` ${color.cyan('g a')} Amend - Smart amend with AI`);
console.log(` ${color.cyan('g u')} Undo - Undo last commit\n`); console.log(` ${color.cyan('g u')} Undo - Undo last commit\n`);
@@ -320,7 +322,7 @@ program.command('help-quick').alias('q')
console.log(color.bold('Essential Workflow:')); console.log(color.bold('Essential Workflow:'));
console.log(` ${color.cyan('g s')} Check what's changed`); console.log(` ${color.cyan('g s')} Check what's changed`);
console.log(` ${color.cyan('g i')} or ${color.cyan('g o')} Commit with AI`); console.log(` ${color.cyan('g i')} or ${color.cyan('g o')} Commit with AI`);
console.log(` ${color.cyan('g h')} View history\n`); console.log(` ${color.cyan('g ls')} or ${color.cyan('g h')} View history\n`);
console.log(`For full help: ${color.cyan('g --help')}`); console.log(`For full help: ${color.cyan('g --help')}`);
console.log(`For detailed docs: See README.md`); console.log(`For detailed docs: See README.md`);
@@ -736,9 +738,8 @@ program.command('amend').alias('a')
} }
}); });
program.command('list').alias('h') program.command('list').alias('ls')
.description('Numbered git log (oldest → newest)') .description('Short numbered git log (oldest → newest)')
.option('--detailed', 'Show detailed information')
.option('--limit <n>', 'Limit number of commits', '20') .option('--limit <n>', 'Limit number of commits', '20')
.action(async (cmdOptions) => { .action(async (cmdOptions) => {
await ensureRepo(); await ensureRepo();
@@ -753,12 +754,7 @@ program.command('list').alias('h')
} }
commits.forEach((c, i) => { commits.forEach((c, i) => {
if (cmdOptions.detailed) { console.log(`${color.cyan((i+1).toString())}. ${color.yellow(c.hash.slice(0,7))} ${c.message}`);
const date = new Date(c.date).toLocaleString();
console.log(`${color.cyan((i+1).toString())}. ${color.yellow(c.hash.slice(0,7))} | ${color.dim(date)} | ${color.green(c.author_name)}${c.message}`);
} else {
console.log(`${color.cyan((i+1).toString())}. ${color.yellow(c.hash.slice(0,7))} ${c.message}`);
}
}); });
if (log.all.length >= limit) { if (log.all.length >= limit) {
@@ -769,6 +765,61 @@ program.command('list').alias('h')
} }
}); });
program.command('largelist').alias('ll')
.description('Detailed numbered git log (oldest → newest)')
.option('--limit <n>', 'Limit number of commits', '20')
.action(async (cmdOptions) => {
await ensureRepo();
try {
const limit = parseInt(cmdOptions.limit) || 20;
const log = await git.log({ maxCount: limit });
const commits = [...log.all].reverse();
if (commits.length === 0) {
Progress.info('No commits found');
return;
}
commits.forEach((c, i) => {
const date = new Date(c.date).toLocaleString();
console.log(`${color.cyan((i+1).toString())}. ${color.yellow(c.hash.slice(0,7))} | ${color.dim(date)} | ${color.green(c.author_name)}${c.message}`);
});
if (log.all.length >= limit) {
console.log(color.dim(`\n... showing last ${limit} commits (use --limit to see more)`));
}
} catch (e) {
handleError('Largelist error', e);
}
});
program.command('history').alias('h')
.description('Numbered git log (alias for list)')
.option('--limit <n>', 'Limit number of commits', '20')
.action(async (cmdOptions) => {
await ensureRepo();
try {
const limit = parseInt(cmdOptions.limit) || 20;
const log = await git.log({ maxCount: limit });
const commits = [...log.all].reverse();
if (commits.length === 0) {
Progress.info('No commits found');
return;
}
commits.forEach((c, i) => {
console.log(`${color.cyan((i+1).toString())}. ${color.yellow(c.hash.slice(0,7))} ${c.message}`);
});
if (log.all.length >= limit) {
console.log(color.dim(`\n... showing last ${limit} commits (use --limit to see more)`));
}
} catch (e) {
handleError('History error', e);
}
});
program.command('branch <c> [name]').alias('b') program.command('branch <c> [name]').alias('b')
.description('Branch from commit/index') .description('Branch from commit/index')
.action(async (c, name) => { .action(async (c, name) => {
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "gims", "name": "gims",
"version": "0.6.2", "version": "0.6.3",
"description": "Git Made Simple AIpowered git helper using Gemini / OpenAI", "description": "Git Made Simple AIpowered git helper using Gemini / OpenAI",
"author": "S41R4J", "author": "S41R4J",
"license": "MIT", "license": "MIT",