contribute-now 0.1.0-staging.7136fcc

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 (3) hide show
  1. package/README.md +284 -0
  2. package/dist/index.js +1454 -0
  3. package/package.json +57 -0
package/README.md ADDED
@@ -0,0 +1,284 @@
1
+ # contribute-now
2
+
3
+ ![GitHub Repo Banner](https://ghrb.waren.build/banner?header=contribute-now+%F0%9F%94%84&subheader=Git+workflow+CLI+for+squash-merge+two-branch+models.+Keeps+dev+in+sync+with+main.&bg=0D1117-21262D&color=FFFFFF&headerfont=Google+Sans+Code&subheaderfont=Sour+Gummy&support=true)
4
+ <!-- Created with GitHub Repo Banner by Waren Gonzaga: https://ghrb.waren.build -->
5
+
6
+ A lightweight CLI that automates git operations for projects using a **two-branch model** (`main` + `dev`) with squash merges โ€” so maintainers and contributors never have to memorize complex sync flows.
7
+
8
+ [![License: GPL-3.0](https://img.shields.io/badge/License-GPL--3.0-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
9
+ [![npm version](https://img.shields.io/npm/v/contribute-now.svg)](https://www.npmjs.com/package/contribute-now)
10
+
11
+ ## The Problem
12
+
13
+ Squash-merging `dev` โ†’ `main` is clean for release history, but it breaks the branch relationship. After the merge, `dev` retains old individual commits that are already in `main`'s squash commit. This causes:
14
+
15
+ - Dev history becomes messy and diverges from main
16
+ - New PRs from dev to main show stale/duplicate commits
17
+ - Contributors struggle to keep their forks in sync
18
+
19
+ **contribute-now** fixes this with a single command: `contrib sync`.
20
+
21
+ ## Features
22
+
23
+ - ๐Ÿ”„ **`contrib sync`** โ€” Resets `dev` to match `main` (maintainer) or `upstream/dev` (contributor) using safe `--force-with-lease`
24
+ - ๐ŸŒฟ **`contrib start`** โ€” Creates feature branches from latest dev, with AI-powered branch name suggestions
25
+ - ๐Ÿ’พ **`contrib commit`** โ€” Generates [Clean Commit](https://github.com/wgtechlabs/clean-commit) messages using GitHub Copilot AI
26
+ - ๐Ÿ”ƒ **`contrib update`** โ€” Rebases your branch onto latest dev, with AI conflict resolution guidance
27
+ - ๐Ÿš€ **`contrib submit`** โ€” Pushes your branch and creates a PR with an AI-generated title and body
28
+ - ๐Ÿงน **`contrib clean`** โ€” Deletes merged branches and prunes remote refs
29
+ - ๐Ÿ“Š **`contrib status`** โ€” Dashboard showing sync state for all branches
30
+ - โš™๏ธ **`contrib setup`** โ€” Auto-detects your role (maintainer/contributor) and writes `.contributerc.json`
31
+ - ๐Ÿค– **AI-powered** โ€” All AI features degrade gracefully if GitHub Copilot is unavailable
32
+ - ๐ŸŽจ **ASCII Banner** โ€” Beautiful ANSI Shadow figlet banner
33
+
34
+ ## Quick Start
35
+
36
+ ```bash
37
+ # Using npx
38
+ npx contribute-now setup
39
+
40
+ # Using bunx
41
+ bunx contribute-now setup
42
+ ```
43
+
44
+ Or install globally:
45
+
46
+ ```bash
47
+ npm install -g contribute-now
48
+ # then use:
49
+ contrib setup
50
+ # or:
51
+ contribute setup
52
+ ```
53
+
54
+ ## Installation
55
+
56
+ ```bash
57
+ # npm
58
+ npm install -g contribute-now
59
+
60
+ # bun
61
+ bun install -g contribute-now
62
+ ```
63
+
64
+ Both `contrib` and `contribute` invoke the same binary.
65
+
66
+ ## Prerequisites
67
+
68
+ - [Git](https://git-scm.com/) (required)
69
+ - [GitHub CLI](https://cli.github.com) (`gh`) โ€” optional, enables role auto-detection and PR creation
70
+ - [GitHub Copilot](https://github.com/features/copilot) subscription โ€” optional, enables AI features
71
+
72
+ ## Usage
73
+
74
+ ### Setup
75
+
76
+ Initialize contribute-now for the current repository:
77
+
78
+ ```bash
79
+ contrib setup
80
+ ```
81
+
82
+ This will:
83
+ 1. Detect your git remotes
84
+ 2. Auto-detect your role as **maintainer** or **contributor** (via `gh` CLI, remote heuristics, or interactive prompt)
85
+ 3. Confirm branch names (`main`, `dev`) and remote names (`origin`, `upstream`)
86
+ 4. Write `.contributerc.json` to the repo root
87
+
88
+ ### Sync
89
+
90
+ Keep `dev` in sync after a squash merge:
91
+
92
+ ```bash
93
+ contrib sync # interactive confirmation
94
+ contrib sync --yes # skip confirmation
95
+ ```
96
+
97
+ **Maintainer flow:** resets `dev` โ†’ `origin/main`
98
+ **Contributor flow:** resets `dev` โ†’ `upstream/dev`
99
+
100
+ Always uses `--force-with-lease` (never bare `--force`).
101
+
102
+ ### Start
103
+
104
+ Create a new feature branch from the latest dev:
105
+
106
+ ```bash
107
+ contrib start feature/user-auth
108
+ contrib start fix/login-timeout
109
+
110
+ # Natural language โ€” AI suggests a proper branch name
111
+ contrib start "fix the login timeout bug"
112
+
113
+ # Skip AI suggestion
114
+ contrib start "fix the login timeout bug" --no-ai
115
+ ```
116
+
117
+ ### Commit
118
+
119
+ Generate a [Clean Commit](https://github.com/wgtechlabs/clean-commit) message with AI, then commit:
120
+
121
+ ```bash
122
+ contrib commit
123
+
124
+ # Use a specific AI model
125
+ contrib commit --model gpt-4.1
126
+
127
+ # Skip AI, type message manually (still validated against Clean Commit format)
128
+ contrib commit --no-ai
129
+ ```
130
+
131
+ The AI generates a message like:
132
+ ```
133
+ ๐Ÿ”ง update (auth): fix login timeout handling
134
+ ```
135
+
136
+ You can accept, edit, regenerate, or write manually.
137
+
138
+ ### Update
139
+
140
+ Rebase your current branch onto the latest dev:
141
+
142
+ ```bash
143
+ contrib update
144
+
145
+ # Skip AI conflict suggestions
146
+ contrib update --no-ai
147
+ ```
148
+
149
+ If a conflict occurs, AI guidance is shown alongside standard resolution instructions.
150
+
151
+ ### Submit
152
+
153
+ Push your branch and open a pull request:
154
+
155
+ ```bash
156
+ contrib submit
157
+ contrib submit --draft
158
+ contrib submit --no-ai # skip AI PR description
159
+ contrib submit --model gpt-4.1
160
+ ```
161
+
162
+ ### Clean
163
+
164
+ Delete merged branches and prune remote refs:
165
+
166
+ ```bash
167
+ contrib clean # shows candidates, asks to confirm
168
+ contrib clean --yes # skip confirmation
169
+ ```
170
+
171
+ ### Status
172
+
173
+ View a dashboard of branch sync states:
174
+
175
+ ```bash
176
+ contrib status
177
+ ```
178
+
179
+ Example output:
180
+ ```
181
+ main โœ“ in sync with origin/main
182
+ dev โ†‘ 3 commits ahead of origin/main (needs sync!)
183
+ feature/user-auth โ†‘ 2 ahead, 0 behind dev (current *)
184
+ ```
185
+
186
+ ## Config File
187
+
188
+ `contrib setup` writes `.contributerc.json` to your repo root:
189
+
190
+ ```json
191
+ {
192
+ "role": "contributor",
193
+ "mainBranch": "main",
194
+ "devBranch": "dev",
195
+ "upstream": "upstream",
196
+ "origin": "origin",
197
+ "branchPrefixes": ["feature", "fix", "docs", "chore", "test", "refactor"]
198
+ }
199
+ ```
200
+
201
+ > Add `.contributerc.json` to your `.gitignore` โ€” it's personal config, not meant to be committed.
202
+
203
+ ## CLI Reference
204
+
205
+ ```
206
+ contrib โ€” Git workflow CLI for squash-merge two-branch models
207
+
208
+ USAGE
209
+ contrib [OPTIONS] setup|sync|start|commit|update|submit|clean|status
210
+
211
+ OPTIONS
212
+ -v, --version Show version number
213
+
214
+ COMMANDS
215
+ setup Initialize config for this repo (.contributerc.json)
216
+ sync Reset dev branch to match origin/main or upstream/dev
217
+ start Create a new feature branch from the latest dev
218
+ commit Stage changes and create a Clean Commit message (AI-powered)
219
+ update Rebase current branch onto latest dev
220
+ submit Push current branch and create a pull request
221
+ clean Delete merged branches and prune remote refs
222
+ status Show sync status of main, dev, and current branch
223
+
224
+ Use contrib <command> --help for more information about a command.
225
+ ```
226
+
227
+ ## AI Features
228
+
229
+ All AI features use **GitHub Copilot** via `@github/copilot-sdk`. They are entirely **optional** โ€” if Copilot is unavailable (no subscription, not installed), the CLI falls back to manual input. You are never blocked.
230
+
231
+ | Command | AI Feature | Fallback |
232
+ |---------|-----------|---------|
233
+ | `commit` | Generate Clean Commit message from staged diff | Type message manually |
234
+ | `start` | Suggest branch name from natural language | Prefix picker + manual name |
235
+ | `update` | Conflict resolution guidance | Standard rebase instructions |
236
+ | `submit` | Generate PR title + body from commits + diff | `gh pr create --fill` or manual |
237
+
238
+ Use `--model <model>` on any AI-powered command to select a specific Copilot model (e.g., `gpt-4.1`, `claude-sonnet-4`).
239
+
240
+ ## Clean Commit Convention
241
+
242
+ This project uses the **[Clean Commit](https://github.com/wgtechlabs/clean-commit)** convention by [@wgtechlabs](https://github.com/wgtechlabs). Every commit must follow this format:
243
+
244
+ ```
245
+ <emoji> <type>[!][(<scope>)]: <description>
246
+ ```
247
+
248
+ | Emoji | Type | Purpose |
249
+ |:-----:|------|---------|
250
+ | ๐Ÿ“ฆ | `new` | New features, files, or capabilities |
251
+ | ๐Ÿ”ง | `update` | Changes, refactoring, improvements |
252
+ | ๐Ÿ—‘๏ธ | `remove` | Removing code, files, or dependencies |
253
+ | ๐Ÿ”’ | `security` | Security fixes or patches |
254
+ | โš™๏ธ | `setup` | Configs, CI/CD, tooling, build systems |
255
+ | โ˜• | `chore` | Maintenance, dependency updates |
256
+ | ๐Ÿงช | `test` | Adding or updating tests |
257
+ | ๐Ÿ“– | `docs` | Documentation changes |
258
+ | ๐Ÿš€ | `release` | Version releases |
259
+
260
+ A Husky commit-msg hook enforces this automatically.
261
+
262
+ ## Development
263
+
264
+ ```bash
265
+ git clone https://github.com/warengonzaga/contribute-now.git
266
+ cd contribute-now
267
+ bun install
268
+
269
+ bun run build # compile to dist/index.js
270
+ bun test # run tests
271
+ bun run lint # check code quality
272
+ ```
273
+
274
+ ## Contributing
275
+
276
+ Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for the workflow, commit convention, and PR guidelines.
277
+
278
+ ## License
279
+
280
+ [GPL-3.0](LICENSE) ยฉ [Waren Gonzaga](https://warengonzaga.com)
281
+
282
+ ---
283
+
284
+ ๐Ÿ’ป๐Ÿ’–โ˜• Made with โค๏ธ by [Waren Gonzaga](https://github.com/warengonzaga)