gittable 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +459 -0
- package/cli.js +342 -0
- package/commands/add.js +159 -0
- package/commands/blame.js +33 -0
- package/commands/branch.js +234 -0
- package/commands/checkout.js +43 -0
- package/commands/cherry-pick.js +104 -0
- package/commands/clean.js +71 -0
- package/commands/clone.js +76 -0
- package/commands/commit.js +82 -0
- package/commands/config.js +171 -0
- package/commands/diff.js +30 -0
- package/commands/fetch.js +76 -0
- package/commands/grep.js +42 -0
- package/commands/init.js +45 -0
- package/commands/log.js +38 -0
- package/commands/merge.js +69 -0
- package/commands/mv.js +40 -0
- package/commands/pull.js +74 -0
- package/commands/push.js +97 -0
- package/commands/rebase.js +134 -0
- package/commands/remote.js +236 -0
- package/commands/restore.js +76 -0
- package/commands/revert.js +63 -0
- package/commands/rm.js +57 -0
- package/commands/show.js +47 -0
- package/commands/stash.js +201 -0
- package/commands/status.js +21 -0
- package/commands/sync.js +98 -0
- package/commands/tag.js +153 -0
- package/commands/undo.js +200 -0
- package/commands/uninit.js +57 -0
- package/index.d.ts +56 -0
- package/index.js +55 -0
- package/lib/commit/build-commit.js +64 -0
- package/lib/commit/get-previous-commit.js +15 -0
- package/lib/commit/questions.js +226 -0
- package/lib/config/read-config-file.js +54 -0
- package/lib/git/exec.js +222 -0
- package/lib/ui/ascii.js +154 -0
- package/lib/ui/banner.js +80 -0
- package/lib/ui/status-display.js +90 -0
- package/lib/ui/table.js +76 -0
- package/lib/utils/email-prompt.js +62 -0
- package/lib/utils/logger.js +47 -0
- package/lib/utils/spinner.js +57 -0
- package/lib/utils/terminal-link.js +55 -0
- package/lib/versions.js +17 -0
- package/package.json +73 -0
- package/standalone.js +24 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
const { info: prettyInfo, warn: prettyWarn, error: prettyError } = require('prettycli');
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Enhanced logger using prettycli for better formatting
|
|
6
|
+
* Falls back to simple logging if prettycli fails
|
|
7
|
+
*/
|
|
8
|
+
const createLogger =
|
|
9
|
+
(color, symbol) =>
|
|
10
|
+
(...args) =>
|
|
11
|
+
console.log(chalk[color](symbol), ...args);
|
|
12
|
+
|
|
13
|
+
const logger = {
|
|
14
|
+
// Use prettycli for enhanced formatting
|
|
15
|
+
info: (label, message) => {
|
|
16
|
+
try {
|
|
17
|
+
prettyInfo(label, message);
|
|
18
|
+
} catch (_err) {
|
|
19
|
+
createLogger('cyan', 'ℹ')(label, message);
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
warn: (message) => {
|
|
24
|
+
try {
|
|
25
|
+
prettyWarn(message);
|
|
26
|
+
} catch (_err) {
|
|
27
|
+
createLogger('yellow', '⚠')(message);
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
error: (message) => {
|
|
32
|
+
try {
|
|
33
|
+
prettyError(message);
|
|
34
|
+
} catch (_err) {
|
|
35
|
+
createLogger('red', '✖')(message);
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
success: createLogger('green', '✔'),
|
|
40
|
+
warning: createLogger('yellow', '⚠'),
|
|
41
|
+
|
|
42
|
+
// Simple loggers (backward compatible)
|
|
43
|
+
log: (...args) => console.log(...args),
|
|
44
|
+
debug: (...args) => console.log(chalk.gray('DEBUG'), ...args),
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
module.exports = logger;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const ora = require('ora');
|
|
2
|
+
const chalk = require('chalk');
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Create an ora spinner with default styling
|
|
6
|
+
* @param {string} text - Initial spinner text
|
|
7
|
+
* @param {object} options - Spinner options
|
|
8
|
+
* @returns {ora.Ora} - Ora spinner instance
|
|
9
|
+
*/
|
|
10
|
+
const createSpinner = (text = '', options = {}) => {
|
|
11
|
+
const { color = 'cyan', spinner = 'dots', ...restOptions } = options;
|
|
12
|
+
|
|
13
|
+
return ora({
|
|
14
|
+
text,
|
|
15
|
+
color,
|
|
16
|
+
spinner,
|
|
17
|
+
...restOptions,
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Execute a function with a spinner
|
|
23
|
+
* @param {string} text - Spinner text
|
|
24
|
+
* @param {Function} fn - Async function to execute
|
|
25
|
+
* @param {object} options - Spinner options
|
|
26
|
+
* @returns {Promise<any>} - Result of the function
|
|
27
|
+
*/
|
|
28
|
+
const withSpinner = async (text, fn, options = {}) => {
|
|
29
|
+
const spinner = createSpinner(text, options);
|
|
30
|
+
spinner.start();
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
const result = await fn();
|
|
34
|
+
spinner.succeed(chalk.green(text.replace('...', ' completed')));
|
|
35
|
+
return result;
|
|
36
|
+
} catch (error) {
|
|
37
|
+
spinner.fail(chalk.red(text.replace('...', ' failed')));
|
|
38
|
+
throw error;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Common spinner presets
|
|
44
|
+
*/
|
|
45
|
+
const spinners = {
|
|
46
|
+
loading: (text) => createSpinner(text, { spinner: 'dots' }),
|
|
47
|
+
downloading: (text) => createSpinner(text, { spinner: 'dots12' }),
|
|
48
|
+
processing: (text) => createSpinner(text, { spinner: 'bouncingBar' }),
|
|
49
|
+
installing: (text) => createSpinner(text, { spinner: 'clock' }),
|
|
50
|
+
building: (text) => createSpinner(text, { spinner: 'triangle' }),
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
module.exports = {
|
|
54
|
+
createSpinner,
|
|
55
|
+
withSpinner,
|
|
56
|
+
spinners,
|
|
57
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
|
|
3
|
+
let terminalLink;
|
|
4
|
+
try {
|
|
5
|
+
const terminalLinkModule = require('terminal-link');
|
|
6
|
+
// Handle ES module default export
|
|
7
|
+
terminalLink = terminalLinkModule.default || terminalLinkModule;
|
|
8
|
+
// Check if it's actually a function
|
|
9
|
+
if (typeof terminalLink !== 'function') {
|
|
10
|
+
terminalLink = null;
|
|
11
|
+
}
|
|
12
|
+
} catch (_e) {
|
|
13
|
+
// terminal-link not installed, will use fallback
|
|
14
|
+
terminalLink = null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Create a clickable terminal link with fallback
|
|
19
|
+
* @param {string} text - Link text
|
|
20
|
+
* @param {string} url - Link URL
|
|
21
|
+
* @param {object} options - Options for styling
|
|
22
|
+
* @returns {string} - Formatted link
|
|
23
|
+
*/
|
|
24
|
+
const createLink = (text, url, options = {}) => {
|
|
25
|
+
const { color = 'cyan', fallback = true } = options;
|
|
26
|
+
|
|
27
|
+
let link;
|
|
28
|
+
if (terminalLink && typeof terminalLink === 'function') {
|
|
29
|
+
link = terminalLink(text, url, { fallback });
|
|
30
|
+
} else {
|
|
31
|
+
// Fallback to plain text with URL in parentheses
|
|
32
|
+
link = fallback ? `${text} (${url})` : text;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (color && link !== text) {
|
|
36
|
+
return chalk[color](link);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return link;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Create multiple links separated by a delimiter
|
|
44
|
+
* @param {Array<{text: string, url: string}>} links - Array of link objects
|
|
45
|
+
* @param {string} separator - Separator between links
|
|
46
|
+
* @returns {string} - Formatted links
|
|
47
|
+
*/
|
|
48
|
+
const createLinks = (links, separator = ' | ') => {
|
|
49
|
+
return links.map(({ text, url, color }) => createLink(text, url, { color })).join(separator);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
module.exports = {
|
|
53
|
+
createLink,
|
|
54
|
+
createLinks,
|
|
55
|
+
};
|
package/lib/versions.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command versions
|
|
3
|
+
* Each command has its own version for independent versioning
|
|
4
|
+
*/
|
|
5
|
+
module.exports = {
|
|
6
|
+
commit: '3.0.0',
|
|
7
|
+
status: '1.0.0',
|
|
8
|
+
branch: '1.0.0',
|
|
9
|
+
pull: '1.0.0',
|
|
10
|
+
push: '1.0.0',
|
|
11
|
+
sync: '1.0.0',
|
|
12
|
+
merge: '1.0.0',
|
|
13
|
+
rebase: '1.0.0',
|
|
14
|
+
stash: '1.0.0',
|
|
15
|
+
log: '1.0.0',
|
|
16
|
+
undo: '1.0.0',
|
|
17
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.0.0",
|
|
3
|
+
"name": "gittable",
|
|
4
|
+
"description": "Modern Git CLI with Conventional Commits",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"types": "index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"gittable": "cli.js",
|
|
9
|
+
"gitt": "cli.js",
|
|
10
|
+
"gitx": "cli.js"
|
|
11
|
+
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"lint": "biome check .",
|
|
14
|
+
"lint:fix": "biome check --write .",
|
|
15
|
+
"format": "biome format --write .",
|
|
16
|
+
"test": "node --test test/**/*.test.js",
|
|
17
|
+
"test:watch": "node --test --watch test/**/*.test.js",
|
|
18
|
+
"commit": "./standalone.js"
|
|
19
|
+
},
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/GG-Santos/Gittable.git"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/GG-Santos/Gittable#readme",
|
|
25
|
+
"bugs": {
|
|
26
|
+
"url": "https://github.com/GG-Santos/Gittable/issues"
|
|
27
|
+
},
|
|
28
|
+
"author": "GG-Santos <ggsantos_0415@proton.me>",
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"keywords": [
|
|
31
|
+
"git",
|
|
32
|
+
"cli",
|
|
33
|
+
"commitizen",
|
|
34
|
+
"commit",
|
|
35
|
+
"conventional-changelog",
|
|
36
|
+
"git-wrapper",
|
|
37
|
+
"version-control"
|
|
38
|
+
],
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@clack/prompts": "^0.7.0",
|
|
41
|
+
"chalk": "^4.1.2",
|
|
42
|
+
"cli-table3": "^0.6.5",
|
|
43
|
+
"email-prompt": "^0.4.0",
|
|
44
|
+
"find-config": "^1.0.0",
|
|
45
|
+
"prettycli": "^1.1.0",
|
|
46
|
+
"word-wrap": "^1.2.5"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@biomejs/biome": "^1.9.4",
|
|
50
|
+
"commitizen": "^4.3.0"
|
|
51
|
+
},
|
|
52
|
+
"files": [
|
|
53
|
+
"cli.js",
|
|
54
|
+
"index.js",
|
|
55
|
+
"index.d.ts",
|
|
56
|
+
"standalone.js",
|
|
57
|
+
"commands",
|
|
58
|
+
"lib"
|
|
59
|
+
],
|
|
60
|
+
"engines": {
|
|
61
|
+
"node": ">=14.0.0"
|
|
62
|
+
},
|
|
63
|
+
"config": {
|
|
64
|
+
"commitizen": {
|
|
65
|
+
"path": "./index.js"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"directories": {
|
|
69
|
+
"lib": "lib",
|
|
70
|
+
"test": "test"
|
|
71
|
+
},
|
|
72
|
+
"type": "commonjs"
|
|
73
|
+
}
|
package/standalone.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { execSync } = require('node:child_process');
|
|
4
|
+
const clack = require('@clack/prompts');
|
|
5
|
+
const chalk = require('chalk');
|
|
6
|
+
const { prompter } = require('./index');
|
|
7
|
+
|
|
8
|
+
const commit = (message) => {
|
|
9
|
+
try {
|
|
10
|
+
execSync(`git commit -m "${message}"`, { stdio: [0, 1, 2] });
|
|
11
|
+
} catch (_error) {
|
|
12
|
+
clack.cancel(chalk.red('Commit failed'));
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
(async () => {
|
|
18
|
+
try {
|
|
19
|
+
await prompter(null, commit);
|
|
20
|
+
} catch (error) {
|
|
21
|
+
console.error(error);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
})();
|