@hallaxius/forge 0.1.3 → 0.1.4

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.
Files changed (45) hide show
  1. package/README.md +160 -158
  2. package/bin/forge.js +2 -2
  3. package/dist/cli.js +12764 -13800
  4. package/package.json +75 -75
  5. package/src/cli.ts +80 -78
  6. package/src/commands/account.ts +80 -0
  7. package/src/commands/alias.ts +66 -66
  8. package/src/commands/branch.ts +46 -46
  9. package/src/commands/ci.ts +28 -28
  10. package/src/commands/clone.ts +100 -100
  11. package/src/commands/commit.ts +88 -88
  12. package/src/commands/config.ts +47 -48
  13. package/src/commands/diff.ts +26 -26
  14. package/src/commands/fetch.ts +20 -20
  15. package/src/commands/help.ts +58 -58
  16. package/src/commands/init.ts +32 -33
  17. package/src/commands/issue.ts +63 -63
  18. package/src/commands/log.ts +29 -29
  19. package/src/commands/merge.ts +37 -37
  20. package/src/commands/pr.ts +65 -65
  21. package/src/commands/push.ts +35 -35
  22. package/src/commands/release.ts +26 -26
  23. package/src/commands/remote.ts +107 -107
  24. package/src/commands/reset.ts +30 -30
  25. package/src/commands/setup.ts +93 -94
  26. package/src/commands/stash.ts +44 -44
  27. package/src/commands/status.ts +74 -74
  28. package/src/commands/sync.ts +20 -20
  29. package/src/commands/tag.ts +41 -41
  30. package/src/commands/undo.ts +27 -27
  31. package/src/commands/version.ts +12 -12
  32. package/src/constants/colors.ts +7 -7
  33. package/src/constants/commit-types.ts +24 -24
  34. package/src/constants/messages.ts +13 -23
  35. package/src/lib/auth.ts +172 -172
  36. package/src/lib/config.ts +108 -108
  37. package/src/lib/git.ts +543 -543
  38. package/src/lib/github.ts +202 -160
  39. package/src/lib/logger.ts +18 -31
  40. package/src/lib/ui.ts +122 -156
  41. package/src/lib/validators.ts +16 -16
  42. package/src/templates/commit-types.json +9 -9
  43. package/src/utils/files.ts +21 -21
  44. package/src/utils/strings.ts +19 -19
  45. package/src/version.const.ts +1 -1
package/README.md CHANGED
@@ -1,159 +1,161 @@
1
- # @hallaxius/forge
2
-
3
- A modern Git CLI with professional UX
4
-
5
- [![npm version](https://img.shields.io/npm/v/@hallaxius/forge.svg)](https://www.npmjs.com/package/@hallaxius/forge) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
-
7
- ## Installation
8
-
9
- Requires [Bun](https://bun.sh) (recommended) or Node.js >= 18.0.0.
10
-
11
- ```bash
12
- # Using npm
13
- npm install -g @hallaxius/forge
14
-
15
- # Using bun
16
- bun install -g @hallaxius/forge
17
- ```
18
-
19
- ## Configuration Tutorial (`fg setup`)
20
-
21
- Run `fg setup` and follow the interactive steps:
22
-
23
- 1. **Name** — your name for commits
24
- 2. **Email** — your email for commits
25
- 3. **GitHub Token** (optional) — for authenticated operations
26
- 4. **Encrypt token?** — if yes, set a master password (AES-GCM)
27
- 5. **Verification** — confirms Git is installed
28
-
29
- Config saved to `~/.forge/config.json`. Token is encrypted.
30
-
31
- To reconfigure: run `fg setup` again.
32
-
33
- ## Commands (26)
34
-
35
- ### Configuration
36
- | Command | Description |
37
- |---------|-------------|
38
- | `fg setup` | Initial interactive configuration |
39
- | `fg config` | Show current config |
40
- | `fg config --edit` | Open in `$EDITOR` (vim default) |
41
- | `fg reset` | Delete all configuration (with confirmation) |
42
- | `fg version` | Show version |
43
- | `fg help` | Full help |
44
- | `fg --help` | Quick help |
45
-
46
- ### Repositories
47
- | Command | Description |
48
- |---------|-------------|
49
- | `fg clone <url\|org/repo> [dir] [--ssh] [--depth N] [--branch X] [--recurse-submodules] [--cd]` | Clone repo; supports `org/repo` shorthand; `--cd` prints `cd dir` for `eval` |
50
- | `fg init [dir] [--initial-commit] [--branch main]` | Initialize repo; `--initial-commit` creates empty commit |
51
- | `fg remote` | List remotes |
52
- | `fg remote add <name> <url>` | Add remote |
53
- | `fg remote remove <name>` | Remove remote (asks confirmation) |
54
- | `fg remote set-url <name> <url>` | Change remote URL |
55
- | `fg remote rename <old> <new>` | Rename remote |
56
- | `fg remote get-url <name>` | Show remote URL |
57
-
58
- ### Commits
59
- | Command | Description |
60
- |---------|-------------|
61
- | `fg commit [-m "msg"] [--amend]` | Interactive commit (type, scope, description) or quick with `-m`; `--amend` amends last |
62
- | `fg undo` | Undo last commit keeping changes (soft reset) |
63
- | `fg log [-n 10]` | Formatted history (hash, date, author, message) |
64
- | `fg diff [--staged]` | Unstaged or staged diff |
65
-
66
- ### Branches
67
- | Command | Description |
68
- |---------|-------------|
69
- | `fg branch` | List branches (current marked with `*`) |
70
- | `fg branch -n <name>` | Create new branch |
71
- | `fg branch -d <name> [--force]` | Delete branch (`--force` = `-D`) |
72
- | `fg branch -s <name>` | Switch to branch |
73
-
74
- ### Push / Pull / Sync
75
- | Command | Description |
76
- |---------|-------------|
77
- | `fg push [--force]` | Push to origin (confirms first; `--force` requires extra confirmation) |
78
- | `fg sync` | Pull with rebase (`git pull --rebase`) |
79
- | `fg fetch` | Fetch from remote |
80
-
81
- ### Status
82
- | Command | Description |
83
- |---------|-------------|
84
- | `fg status` | Branch, ahead/behind, modified files (table), last 3 commits |
85
- | `fg st` | Short status |
86
-
87
- ### Stash
88
- | Command | Description |
89
- |---------|-------------|
90
- | `fg stash` | Save stash (prompts for message) |
91
- | `fg stash --pop` | Apply and drop latest stash |
92
- | `fg stash --list` | List stashes |
93
-
94
- ### Tags
95
- | Command | Description |
96
- |---------|-------------|
97
- | `fg tag -n <name> [-m "msg"]` | Create tag (annotated with `-m`) |
98
- | `fg tag --list` | List tags |
99
-
100
- ### Worktrees
101
- | Command | Description |
102
- |---------|-------------|
103
- | `fg worktree add <path> [branch] [--new] [--detach]` | Add worktree; `--new` creates branch; `--detach` detached HEAD |
104
- | `fg worktree list` | List worktrees (path, branch, hash) |
105
- | `fg worktree remove <path> [--force]` | Remove worktree |
106
- | `fg worktree prune [--dry-run]` | Prune stale references |
107
-
108
- ### Merge / Cherry-pick
109
- | Command | Description |
110
- |---------|-------------|
111
- | `fg merge <branch> [--no-ff] [--squash] [--no-commit]` | Merge with options |
112
- | `fg cherry-pick <commits...> [--no-commit] [--mainline N]` | Apply commits |
113
- | `fg cherry-pick --continue` | Continue after conflict |
114
- | `fg cherry-pick --abort` | Abort cherry-pick |
115
-
116
- ### Clean / Archive
117
- | Command | Description |
118
- |---------|-------------|
119
- | `fg clean [paths...] [--dry-run] [--force] [--exclude pattern]` | Remove untracked files; `--dry-run` shows only; without `--force` asks confirmation |
120
- | `fg archive <tar\|tar.gz\|zip> [--prefix dir/] [--output file] [--tree-ish ref]` | Create repository archive |
121
-
122
- ### Bisect
123
- | Command | Description |
124
- |---------|-------------|
125
- | `fg bisect start [bad] [good...]` | Start bisect session |
126
- | `fg bisect bad [commit]` | Mark bad (default HEAD) |
127
- | `fg bisect good <commits...>` | Mark good |
128
- | `fg bisect reset` | Reset bisect state |
129
- | `fg bisect log` | Show bisect log |
130
- | `fg bisect run <cmd>` | Run automated bisect script |
131
-
132
- ### Aliases
133
- | Command | Description |
134
- |---------|-------------|
135
- | `fg alias add <name> <command>` | Add alias (e.g., `fg alias add g commit`) |
136
- | `fg alias list` | List aliases |
137
- | `fg alias remove <name>` | Remove alias |
138
-
139
- ## Configuration
140
-
141
- File: `~/.forge/config.json`
142
-
143
- ```json
144
- {
145
- "user": { "name": "", "email": "" },
146
- "github": { "token": "encrypted" },
147
- "preferences": { "autoPush": false, "commitTemplate": "conventional", "editor": "vim" },
148
- "clones": [],
149
- "aliases": {}
150
- }
151
- ```
152
-
153
- - GitHub token encrypted with AES-GCM (Web Crypto API)
154
- - `clones`: last 10 clones for `fg clone --list`
155
- - `aliases`: custom shortcuts
156
-
157
- ## License
158
-
1
+ # @hallaxius/forge
2
+
3
+ A modern Git CLI with professional UX
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@hallaxius/forge.svg)](https://www.npmjs.com/package/@hallaxius/forge) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![npm downloads](https://img.shields.io/npm/dt/@hallaxius/forge.svg)](https://www.npmjs.com/package/@hallaxius/forge) [![npm weekly downloads](https://img.shields.io/npm/dw/@hallaxius/forge.svg)](https://www.npmjs.com/package/@hallaxius/forge) [![GitHub stars](https://img.shields.io/github/stars/hallaxius/forge.svg?style=social)](https://github.com/hallaxius/forge/stargazers) [![GitHub forks](https://img.shields.io/github/forks/hallaxius/forge.svg?style=social)](https://github.com/hallaxius/forge/network) [![GitHub issues](https://img.shields.io/github/issues/hallaxius/forge.svg)](https://github.com/hallaxius/forge/issues) [![GitHub closed issues](https://img.shields.io/github/issues-closed/hallaxius/forge.svg)](https://github.com/hallaxius/forge/issues?q=is%3Aissue+is%3Aclosed) [![Bun](https://img.shields.io/badge/Bun-1.0.0%2B-ff69b4.svg)](https://bun.sh) [![Node.js](https://img.shields.io/badge/Node.js-%3E%3D18.0.0-green.svg)](https://nodejs.org) [![TypeScript](https://img.shields.io/badge/TypeScript-5.3%2B-blue.svg)](https://www.typescriptlang.org) [![Codecov](https://img.shields.io/codecov/c/github/hallaxius/forge.svg)](https://codecov.io/gh/hallaxius/forge) [![GitHub last commit](https://img.shields.io/github/last-commit/hallaxius/forge.svg)](https://github.com/hallaxius/forge/commits)
6
+
7
+ ## Installation
8
+
9
+ Requires [Bun](https://bun.sh) (recommended) or Node.js >= 18.0.0.
10
+
11
+ ```bash
12
+ # Using npm
13
+ npm install -g @hallaxius/forge
14
+
15
+ # Using bun
16
+ bun install -g @hallaxius/forge
17
+ ```
18
+
19
+ ## Configuration Tutorial (`fg setup`)
20
+
21
+ Run `fg setup` and follow the interactive steps:
22
+
23
+ 1. **Name** — your name for commits
24
+ 2. **Email** — your email for commits
25
+ 3. **GitHub Token** (optional) — for authenticated operations
26
+ 4. **Encrypt token?** — if yes, set a master password (AES-GCM)
27
+ 5. **Verification** — confirms Git is installed
28
+
29
+ Config saved to `~/.forge/config.json`. Token is encrypted.
30
+
31
+ To reconfigure: run `fg setup` again.
32
+
33
+ ## Commands (30)
34
+
35
+ ### Configuration
36
+ | Command | Description |
37
+ |---------|-------------|
38
+ | `fg setup` | Initial interactive configuration |
39
+ | `fg config` | Show current config |
40
+ | `fg config --edit` | Open in `$EDITOR` (vim default) |
41
+ | `fg reset` | Delete all configuration (with confirmation) |
42
+ | `fg version` | Show version |
43
+ | `fg help` | Full help |
44
+ | `fg --help` | Quick help |
45
+ | `fg account` | Display account information (local and GitHub) |
46
+
47
+ ### Repositories
48
+ | Command | Description |
49
+ |---------|-------------|
50
+ | `fg clone <url\|org/repo> [dir] [--ssh] [--depth N] [--branch X] [--recurse-submodules] [--cd]` | Clone repo; supports `org/repo` shorthand; `--cd` prints `cd dir` for `eval` |
51
+ | `fg init [dir] [--initial-commit] [--branch main]` | Initialize repo; `--initial-commit` creates empty commit |
52
+ | `fg remote` | List remotes |
53
+ | `fg remote add <name> <url>` | Add remote |
54
+ | `fg remote remove <name>` | Remove remote (asks confirmation) |
55
+ | `fg remote set-url <name> <url>` | Change remote URL |
56
+ | `fg remote rename <old> <new>` | Rename remote |
57
+ | `fg remote get-url <name>` | Show remote URL |
58
+
59
+ ### Commits
60
+ | Command | Description |
61
+ |---------|-------------|
62
+ | `fg commit [-m "msg"] [--amend]` | Interactive commit (type, scope, description) or quick with `-m`; `--amend` amends last |
63
+ | `fg undo` | Undo last commit keeping changes (soft reset) |
64
+ | `fg log [-n 10]` | Formatted history (hash, date, author, message) |
65
+ | `fg diff [--staged]` | Unstaged or staged diff |
66
+
67
+ ### Branches
68
+ | Command | Description |
69
+ |---------|-------------|
70
+ | `fg branch` | List branches (current marked with `*`) |
71
+ | `fg branch -n <name>` | Create new branch |
72
+ | `fg branch -d <name> [--force]` | Delete branch (`--force` = `-D`) |
73
+ | `fg branch -s <name>` | Switch to branch |
74
+
75
+ ### Push / Pull / Sync
76
+ | Command | Description |
77
+ |---------|-------------|
78
+ | `fg push [--force]` | Push to origin (confirms first; `--force` requires extra confirmation) |
79
+ | `fg sync` | Pull with rebase (`git pull --rebase`) |
80
+ | `fg fetch` | Fetch from remote |
81
+
82
+ ### Status
83
+ | Command | Description |
84
+ |---------|-------------|
85
+ | `fg status` | Branch, ahead/behind, modified files (table), last 3 commits |
86
+ | `fg st` | Short status |
87
+
88
+ ### Stash
89
+ | Command | Description |
90
+ |---------|-------------|
91
+ | `fg stash` | Save stash (prompts for message) |
92
+ | `fg stash --pop` | Apply and drop latest stash |
93
+ | `fg stash --list` | List stashes |
94
+
95
+ ### Tags
96
+ | Command | Description |
97
+ |---------|-------------|
98
+ | `fg tag -n <name> [-m "msg"]` | Create tag (annotated with `-m`) |
99
+ | `fg tag --list` | List tags |
100
+
101
+ ### Merge / Cherry-pick
102
+ | Command | Description |
103
+ |---------|-------------|
104
+ | `fg merge <branch> [--no-ff] [--squash] [--no-commit]` | Merge with options |
105
+ | `fg cherry-pick <commits...> [--no-commit] [--mainline N]` | Apply commits |
106
+ | `fg cherry-pick --continue` | Continue after conflict |
107
+ | `fg cherry-pick --abort` | Abort cherry-pick |
108
+
109
+ ### Clean
110
+ | Command | Description |
111
+ |---------|-------------|
112
+ | `fg clean [paths...] [--dry-run] [--force] [--exclude pattern]` | Remove untracked files; `--dry-run` shows only; without `--force` asks confirmation |
113
+
114
+ ### GitHub Integration
115
+ | Command | Description |
116
+ |---------|-------------|
117
+ | `fg ci` | Check CI status for the repository |
118
+ | `fg issue list [-s, --state <state>]` | List GitHub issues (filter by state: open, closed, all) |
119
+ | `fg issue create [-t, --title <title>]` | Create a new GitHub issue |
120
+ | `fg pr list [-s, --state <state>]` | List pull requests (filter by state: open, closed, all) |
121
+ | `fg pr create [-t, --title <title>] [-H, --head <branch>] [-B, --base <branch>]` | Create a new pull request |
122
+ | `fg release <tag> [-n, --name <name>]` | Create a GitHub release |
123
+
124
+ ### Aliases
125
+ | Command | Description |
126
+ |---------|-------------|
127
+ | `fg alias add <name> <command>` | Add alias (e.g., `fg alias add g commit`) |
128
+ | `fg alias list` | List aliases |
129
+ | `fg alias remove <name>` | Remove alias |
130
+
131
+ ## Configuration
132
+
133
+ File: `~/.forge/config.json`
134
+
135
+ ```json
136
+ {
137
+ "user": { "name": "", "email": "" },
138
+ "github": { "token": "encrypted" },
139
+ "preferences": { "autoPush": false, "commitTemplate": "conventional", "editor": "vim" },
140
+ "clones": [],
141
+ "aliases": {}
142
+ }
143
+ ```
144
+
145
+ - GitHub token encrypted with AES-GCM (Web Crypto API)
146
+ - `clones`: last 10 clones for `fg clone --list`
147
+ - `aliases`: custom shortcuts
148
+
149
+ ## Dependencies
150
+
151
+ - **[Bun](https://bun.sh)** (recommended) or **Node.js >= 18.0.0**
152
+ - **[@octokit/rest](https://github.com/octokit/rest.js)** - GitHub API client
153
+ - **[isomorphic-git](https://github.com/isomorphic-git/isomorphic-git)** - Git operations
154
+ - **[commander](https://github.com/tj/commander.js)** - CLI framework
155
+ - **[inquirer](https://github.com/SBoudrias/Inquirer.js)** - Interactive prompts
156
+ - **[chalk](https://github.com/chalk/chalk)** - Terminal colors
157
+ - **[ora](https://github.com/sindresorhus/ora)** - Spinners
158
+
159
+ ## License
160
+
159
161
  MIT
package/bin/forge.js CHANGED
@@ -1,2 +1,2 @@
1
- #!/usr/bin/env bun
2
- import "../dist/cli.js";
1
+ #!/usr/bin/env bun
2
+ import "../dist/cli.js";