@hallaxius/forge 0.1.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.
Files changed (44) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +159 -0
  3. package/bin/forge.js +2 -0
  4. package/dist/cli.js +35641 -0
  5. package/package.json +65 -0
  6. package/src/cli.ts +78 -0
  7. package/src/commands/alias.ts +66 -0
  8. package/src/commands/archive.ts +35 -0
  9. package/src/commands/bisect.ts +102 -0
  10. package/src/commands/branch.ts +46 -0
  11. package/src/commands/cherry-pick.ts +57 -0
  12. package/src/commands/clean.ts +76 -0
  13. package/src/commands/clone.ts +100 -0
  14. package/src/commands/commit.ts +93 -0
  15. package/src/commands/config.ts +48 -0
  16. package/src/commands/diff.ts +26 -0
  17. package/src/commands/fetch.ts +20 -0
  18. package/src/commands/help.ts +58 -0
  19. package/src/commands/init.ts +37 -0
  20. package/src/commands/log.ts +29 -0
  21. package/src/commands/merge.ts +37 -0
  22. package/src/commands/push.ts +35 -0
  23. package/src/commands/remote.ts +107 -0
  24. package/src/commands/reset.ts +30 -0
  25. package/src/commands/setup.ts +95 -0
  26. package/src/commands/stash.ts +44 -0
  27. package/src/commands/status.ts +74 -0
  28. package/src/commands/sync.ts +20 -0
  29. package/src/commands/tag.ts +41 -0
  30. package/src/commands/undo.ts +27 -0
  31. package/src/commands/version.ts +19 -0
  32. package/src/commands/worktree.ts +92 -0
  33. package/src/constants/colors.ts +7 -0
  34. package/src/constants/commit-types.ts +24 -0
  35. package/src/constants/messages.ts +23 -0
  36. package/src/lib/auth.ts +95 -0
  37. package/src/lib/config.ts +99 -0
  38. package/src/lib/git.ts +382 -0
  39. package/src/lib/logger.ts +31 -0
  40. package/src/lib/ui.ts +162 -0
  41. package/src/lib/validators.ts +27 -0
  42. package/src/templates/commit-types.json +9 -0
  43. package/src/utils/files.ts +21 -0
  44. package/src/utils/strings.ts +19 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Hallaxius
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,159 @@
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
+
159
+ MIT
package/bin/forge.js ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bun
2
+ import "../dist/cli.js";