@harryisfish/gitt 1.1.0 → 1.1.1

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/README.md CHANGED
@@ -1,53 +1,53 @@
1
1
  # Gitt
2
2
 
3
- 用来删除那些在远端已经删除但是本地还残留的分支。
3
+ A command-line tool to delete local branches that have been deleted on the remote repository.
4
4
 
5
- ## 安装
5
+ ## Installation
6
6
 
7
- 使用 npm
7
+ Using npm:
8
8
 
9
9
  ```bash
10
10
  npm install -g @harryisfish/gitt
11
11
  ```
12
12
 
13
- 使用 pnpm
13
+ Using pnpm:
14
14
 
15
15
  ```bash
16
16
  pnpm add -g @harryisfish/gitt
17
17
  ```
18
18
 
19
- ## 使用方法
19
+ ## Usage
20
20
 
21
21
  ```bash
22
22
  gitt
23
23
  ```
24
24
 
25
- ## 配置
25
+ ## Configuration
26
26
 
27
- Gitt 会自动使用你的 Git 全局配置。无需额外配置。
27
+ Gitt automatically uses your Git global configuration. No additional setup required.
28
28
 
29
- ## 文档
29
+ ## Documentation
30
30
 
31
- - [开发文档](./docs/DEVELOPMENT.md)
32
- - [贡献指南](./docs/CONTRIBUTING.md)
33
- - [架构文档](./docs/ARCHITECTURE.md)
31
+ - [Development Guide](./docs/DEVELOPMENT.md)
32
+ - [Contributing Guide](./docs/CONTRIBUTING.md)
33
+ - [Architecture Documentation](./docs/ARCHITECTURE.md)
34
34
 
35
- ## 常见问题
35
+ ## FAQ
36
36
 
37
- ### Q: 遇到 "权限不足" 错误怎么办?
38
- A: 请确保你有相应仓库的访问权限,并且已经正确配置了 SSH 密钥或者 Git 凭证。
37
+ ### Q: What should I do when encountering "insufficient permissions" error?
38
+ A: Please ensure you have access permissions to the repository and have properly configured SSH keys or Git credentials.
39
39
 
40
- ### Q: 如何处理合并冲突?
41
- A: 当发生合并冲突时,Gitt 会提示你手动解决冲突。解决后,使用 `gitt commit` 继续完成合并操作。
40
+ ### Q: How to handle merge conflicts?
41
+ A: When merge conflicts occur, Gitt will prompt you to resolve them manually. After resolution, use `gitt commit` to continue and complete the merge operation.
42
42
 
43
- ## 开发相关
43
+ ## Development
44
44
 
45
- 详细的开发指南请参考 [开发文档](./docs/DEVELOPMENT.md)
45
+ For detailed development guidelines, please refer to the [Development Guide](./docs/DEVELOPMENT.md).
46
46
 
47
- ## 许可证
47
+ ## License
48
48
 
49
49
  [MIT](./LICENSE)
50
50
 
51
51
  ---
52
52
 
53
- 如果你觉得这个项目有帮助,欢迎 star ⭐️
53
+ If you find this project helpful, please give it a star ⭐️
@@ -11,11 +11,11 @@ const git = (0, simple_git_1.simpleGit)();
11
11
  */
12
12
  async function cleanDeletedBranches() {
13
13
  try {
14
- console.log('正在切换到 main 分支...');
14
+ console.log('Switching to main branch...');
15
15
  await git.checkout('main');
16
- console.log('正在拉取最新代码...');
16
+ console.log('Pulling latest code...');
17
17
  await git.pull();
18
- console.log('正在清理远程已删除的分支...');
18
+ console.log('Cleaning up remotely deleted branches...');
19
19
  // 获取最新的远程分支信息
20
20
  await git.fetch(['--prune']);
21
21
  // 获取所有分支信息
@@ -26,18 +26,18 @@ async function cleanDeletedBranches() {
26
26
  return branchInfo.label && branchInfo.label.includes(': gone]');
27
27
  });
28
28
  if (deletedBranches.length === 0) {
29
- console.log('没有需要清理的分支。');
29
+ console.log('No branches need to be cleaned up.');
30
30
  return;
31
31
  }
32
- console.log('以下分支将被删除:', deletedBranches.join(', '));
32
+ console.log('The following branches will be deleted:', deletedBranches.join(', '));
33
33
  // 删除这些分支
34
34
  for (const branch of deletedBranches) {
35
35
  await git.branch(['-D', branch]);
36
- console.log(`已删除分支: ${branch}`);
36
+ console.log(`Deleted branch: ${branch}`);
37
37
  }
38
- (0, errors_2.printSuccess)('分支清理完成');
38
+ (0, errors_2.printSuccess)('Branch cleanup completed');
39
39
  }
40
40
  catch (error) {
41
- throw new errors_1.GitError(error instanceof Error ? error.message : '清理分支时发生未知错误');
41
+ throw new errors_1.GitError(error instanceof Error ? error.message : 'Unknown error occurred while cleaning branches');
42
42
  }
43
43
  }
package/dist/errors.js CHANGED
@@ -13,7 +13,7 @@ class GitError extends Error {
13
13
  }
14
14
  exports.GitError = GitError;
15
15
  class UserCancelError extends Error {
16
- constructor(message = '操作已取消') {
16
+ constructor(message = 'Operation cancelled') {
17
17
  super(message);
18
18
  this.name = 'UserCancelError';
19
19
  }
@@ -30,14 +30,14 @@ function handleError(error) {
30
30
  process.exit(0);
31
31
  }
32
32
  if (error instanceof GitError) {
33
- console.error(`${ERROR_COLOR}错误:${RESET_COLOR}${error.message}`);
33
+ console.error(`${ERROR_COLOR}Error: ${RESET_COLOR}${error.message}`);
34
34
  process.exit(1);
35
35
  }
36
36
  if (error instanceof Error) {
37
- console.error(`${ERROR_COLOR}程序错误:${RESET_COLOR}${error.message}`);
37
+ console.error(`${ERROR_COLOR}Program error: ${RESET_COLOR}${error.message}`);
38
38
  process.exit(1);
39
39
  }
40
- console.error(`${ERROR_COLOR}发生未知错误${RESET_COLOR}`);
40
+ console.error(`${ERROR_COLOR}Unknown error occurred${RESET_COLOR}`);
41
41
  process.exit(1);
42
42
  }
43
43
  // 成功消息处理
package/dist/index.js CHANGED
@@ -7,38 +7,38 @@ const clean_1 = require("./commands/clean");
7
7
  const git = (0, simple_git_1.simpleGit)();
8
8
  // 处理 Ctrl+C 和其他终止信号
9
9
  process.on('SIGINT', () => {
10
- throw new errors_1.UserCancelError('\n操作已取消');
10
+ throw new errors_1.UserCancelError('\nOperation cancelled');
11
11
  });
12
12
  process.on('SIGTERM', () => {
13
- throw new errors_1.UserCancelError('\n程序被终止');
13
+ throw new errors_1.UserCancelError('\nProgram terminated');
14
14
  });
15
15
  // 初始化 Git 仓库
16
16
  async function initGitRepo() {
17
17
  try {
18
18
  await git.init();
19
- (0, errors_1.printSuccess)('Git 仓库初始化成功');
19
+ (0, errors_1.printSuccess)('Git repository initialized successfully');
20
20
  }
21
21
  catch (error) {
22
- throw new errors_1.GitError('Git 仓库初始化失败');
22
+ throw new errors_1.GitError('Failed to initialize Git repository');
23
23
  }
24
24
  }
25
25
  // 检查当前目录是否是 Git 仓库
26
26
  async function checkGitRepo() {
27
27
  const isRepo = await git.checkIsRepo();
28
28
  if (!isRepo) {
29
- throw new errors_1.GitError('当前目录不是 Git 仓库');
29
+ throw new errors_1.GitError('Current directory is not a Git repository');
30
30
  }
31
31
  // 检查是否有远程仓库配置
32
32
  const remotes = await git.getRemotes();
33
33
  if (remotes.length === 0) {
34
- throw new errors_1.GitError('当前 Git 仓库未配置远程仓库');
34
+ throw new errors_1.GitError('Current Git repository has no remote configured');
35
35
  }
36
36
  // 检查是否能访问远程仓库
37
37
  try {
38
38
  await git.fetch(['--dry-run']);
39
39
  }
40
40
  catch (error) {
41
- throw new errors_1.GitError('无法访问远程仓库,请检查网络连接或仓库权限');
41
+ throw new errors_1.GitError('Cannot access remote repository, please check network connection or repository permissions');
42
42
  }
43
43
  }
44
44
  async function main() {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@harryisfish/gitt",
3
- "version": "1.1.0",
4
- "description": "这是一个命令行工具,用于帮助你管理 Git 仓库与远端仓库,如保持同步、推送、拉取等。",
3
+ "version": "1.1.1",
4
+ "description": "A command-line tool to help you manage Git repositories and remote repositories, such as keeping in sync, pushing, pulling, etc.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
7
7
  "gitt": "./dist/index.js"