contribute-now 0.1.2 → 0.2.0-dev.0de9dbd

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 +162 -133
  2. package/dist/index.js +2599 -885
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -1,56 +1,56 @@
1
1
  # contribute-now
2
2
 
3
- ![GitHub Repo Banner](https://ghrb.waren.build/banner?header=contribute-now+%F0%9F%94%84&subheader=Squash.+Merge.+Stay+in+sync.&bg=0D1117-21262D&color=FFFFFF&headerfont=Google+Sans+Code&subheaderfont=Sour+Gummy&support=true)
3
+ ![GitHub Repo Banner](https://ghrb.waren.build/banner?header=contribute-now+%F0%9F%94%84&subheader=Any+workflow.+Clean+commits.+Zero+friction.&bg=0D1117-21262D&color=FFFFFF&headerfont=Google+Sans+Code&subheaderfont=Sour+Gummy&support=true)
4
4
  <!-- Created with GitHub Repo Banner by Waren Gonzaga: https://ghrb.waren.build -->
5
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.
6
+ **contribute-now** is a developer CLI that automates git workflows branching, syncing, staging, committing, and opening PRs — so you can focus on shipping, not on memorizing git commands.
7
+
8
+ It natively supports multiple workflow models and commit conventions, with AI-powered assistance throughout.
7
9
 
8
10
  [![License: GPL-3.0](https://img.shields.io/badge/License-GPL--3.0-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
9
11
  [![npm version](https://img.shields.io/npm/v/contribute-now.svg)](https://www.npmjs.com/package/contribute-now)
10
12
 
11
- ## The Problem
13
+ ---
14
+
15
+ ## Workflow Modes
12
16
 
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:
17
+ Pick the model that matches your project during `contrib setup`. contribute-now adapts its commands to your chosen workflow automatically no manual branch names to remember.
14
18
 
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
19
+ | Mode | Branches | Strategy | Default |
20
+ |------|----------|----------|:-------:|
21
+ | 🌊 **Clean Flow** *(by WGTech Labs)* | `main` + `dev` + feature branches | Squash features → `dev`, merge `dev` → `main` | ✅ |
22
+ | 🐙 **GitHub Flow** | `main` + feature branches | Squash/merge features → `main` | |
23
+ | 🔀 **Git Flow** | `main` + `develop` + release/hotfix branches | Full ceremony branching | |
18
24
 
19
- **contribute-now** fixes this with a single command: `contrib sync`.
25
+ ## Commit Conventions
20
26
 
21
- ## Features
27
+ contribute-now validates commit messages and guides your AI toward the right format — based on whichever convention you configure.
22
28
 
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
29
+ | Convention | Format | Default |
30
+ |------------|--------|:-------:|
31
+ | 🧹 **Clean Commit** *(by WGTech Labs)* | `<emoji> <type>[!][(<scope>)]: <description>` | |
32
+ | 📝 **Conventional Commits** | `<type>[!][(<scope>)]: <description>` | |
33
+ | 🚫 **None** | No enforcement | |
34
+
35
+ ---
33
36
 
34
37
  ## Quick Start
35
38
 
36
39
  ```bash
37
- # Using npx
38
40
  npx contribute-now setup
39
-
40
- # Using bunx
41
- bunx contribute-now setup
42
41
  ```
43
42
 
44
43
  Or install globally:
45
44
 
46
45
  ```bash
47
46
  npm install -g contribute-now
48
- # then use:
49
47
  contrib setup
50
- # or:
51
- contribute setup
52
48
  ```
53
49
 
50
+ > Both `contrib` and `contribute` invoke the same binary.
51
+
52
+ ---
53
+
54
54
  ## Installation
55
55
 
56
56
  ```bash
@@ -61,192 +61,173 @@ npm install -g contribute-now
61
61
  bun install -g contribute-now
62
62
  ```
63
63
 
64
- Both `contrib` and `contribute` invoke the same binary.
65
-
66
64
  ## Prerequisites
67
65
 
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
66
+ - **[Git](https://git-scm.com/)** required
67
+ - **[GitHub CLI](https://cli.github.com)** (`gh`) — optional; enables role auto-detection and PR creation
68
+ - **[GitHub Copilot](https://github.com/features/copilot)** — optional; enables AI features
69
+
70
+ ---
71
71
 
72
- ## Usage
72
+ ## Commands
73
73
 
74
- ### Setup
74
+ ### `contrib setup`
75
75
 
76
- Initialize contribute-now for the current repository:
76
+ Interactive setup wizard. Configures your repo's workflow mode, commit convention, your role, and branch/remote names. Writes `.contributerc.json`.
77
77
 
78
78
  ```bash
79
79
  contrib setup
80
80
  ```
81
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
82
+ Steps:
83
+ 1. Choose **workflow mode** — Clean Flow, GitHub Flow, or Git Flow
84
+ 2. Choose **commit convention** Clean Commit, Conventional Commits, or None
85
+ 3. Detect remotes and auto-detect your **role** (maintainer or contributor)
86
+ 4. Confirm branch and remote names
87
+ 5. Write `.contributerc.json`
88
+
89
+ ---
87
90
 
88
- ### Sync
91
+ ### `contrib sync`
89
92
 
90
- Keep `dev` in sync after a squash merge:
93
+ Pull the latest changes from the correct remote branch based on your workflow and role.
91
94
 
92
95
  ```bash
93
- contrib sync # interactive confirmation
96
+ contrib sync # with confirmation
94
97
  contrib sync --yes # skip confirmation
95
98
  ```
96
99
 
97
- **Maintainer flow:** resets `dev` `origin/main`
98
- **Contributor flow:** resets `dev` → `upstream/dev`
100
+ | Role | Clean Flow / Git Flow | GitHub Flow |
101
+ |------|-----------------------|-------------|
102
+ | Maintainer | pulls `origin/dev` | pulls `origin/main` |
103
+ | Contributor | pulls `upstream/dev` | pulls `upstream/main` |
99
104
 
100
- Always uses `--force-with-lease` (never bare `--force`).
105
+ ---
101
106
 
102
- ### Start
107
+ ### `contrib start`
103
108
 
104
- Create a new feature branch from the latest dev:
109
+ Create a new feature branch from the correct base branch, with optional AI-powered branch naming.
105
110
 
106
111
  ```bash
112
+ # Direct branch name
107
113
  contrib start feature/user-auth
108
- contrib start fix/login-timeout
109
114
 
110
- # Natural language — AI suggests a proper branch name
111
- contrib start "fix the login timeout bug"
115
+ # Natural language — AI suggests the branch name
116
+ contrib start "add user authentication"
112
117
 
113
- # Skip AI suggestion
114
- contrib start "fix the login timeout bug" --no-ai
118
+ # Skip AI
119
+ contrib start "add user authentication" --no-ai
115
120
  ```
116
121
 
117
- ### Commit
122
+ ---
118
123
 
119
- Generate a [Clean Commit](https://github.com/wgtechlabs/clean-commit) message with AI, then commit:
124
+ ### `contrib commit`
120
125
 
121
- ```bash
122
- contrib commit
126
+ Stage your changes and create a validated, AI-generated commit message matching your configured convention.
123
127
 
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
128
+ ```bash
129
+ contrib commit # AI-generated message
130
+ contrib commit --no-ai # manual entry, still validated
131
+ contrib commit --model gpt-4.1 # specific AI model
129
132
  ```
130
133
 
131
- The AI generates a message like:
132
- ```
133
- 🔧 update (auth): fix login timeout handling
134
- ```
134
+ After the AI generates a message, you can **accept**, **edit**, **regenerate**, or **write manually**. Messages are always validated against your convention — with a soft warning if they don't match (you can still commit).
135
135
 
136
- You can accept, edit, regenerate, or write manually.
136
+ ---
137
137
 
138
- ### Update
138
+ ### `contrib update`
139
139
 
140
- Rebase your current branch onto the latest dev:
140
+ Rebase your current branch onto the latest base branch, with AI guidance if conflicts occur.
141
141
 
142
142
  ```bash
143
143
  contrib update
144
-
145
- # Skip AI conflict suggestions
146
- contrib update --no-ai
144
+ contrib update --no-ai # skip AI conflict guidance
147
145
  ```
148
146
 
149
- If a conflict occurs, AI guidance is shown alongside standard resolution instructions.
147
+ ---
150
148
 
151
- ### Submit
149
+ ### `contrib submit`
152
150
 
153
- Push your branch and open a pull request:
151
+ Push your branch and open a pull request with an AI-generated title and description.
154
152
 
155
153
  ```bash
156
154
  contrib submit
157
155
  contrib submit --draft
158
- contrib submit --no-ai # skip AI PR description
156
+ contrib submit --no-ai
159
157
  contrib submit --model gpt-4.1
160
158
  ```
161
159
 
162
- ### Clean
160
+ ---
161
+
162
+ ### `contrib clean`
163
163
 
164
- Delete merged branches and prune remote refs:
164
+ Delete merged branches and prune stale remote refs.
165
165
 
166
166
  ```bash
167
- contrib clean # shows candidates, asks to confirm
168
- contrib clean --yes # skip confirmation
167
+ contrib clean # shows candidates, asks to confirm
168
+ contrib clean --yes # skip confirmation
169
169
  ```
170
170
 
171
- ### Status
171
+ ---
172
+
173
+ ### `contrib status`
172
174
 
173
- View a dashboard of branch sync states:
175
+ Show a sync status dashboard for your main, dev, and current branch.
174
176
 
175
177
  ```bash
176
178
  contrib status
177
179
  ```
178
180
 
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
- ```
181
+ ---
185
182
 
186
- ## Config File
183
+ ### `contrib hook`
187
184
 
188
- `contrib setup` writes `.contributerc.json` to your repo root:
185
+ Install or uninstall a `commit-msg` git hook that validates every commit against your configured convention — no Husky or lint-staged needed.
189
186
 
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
- }
187
+ ```bash
188
+ contrib hook install # writes .git/hooks/commit-msg
189
+ contrib hook uninstall # removes it
199
190
  ```
200
191
 
201
- > Add `.contributerc.json` to your `.gitignore` — it's personal config, not meant to be committed.
192
+ - Automatically skips merge commits, fixup, squash, and amend commits
193
+ - Won't overwrite hooks it didn't create
202
194
 
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
195
+ ---
210
196
 
211
- OPTIONS
212
- -v, --version Show version number
197
+ ### `contrib validate`
213
198
 
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
199
+ Validate a commit message against your configured convention. Exits `0` if valid, `1` if not — useful in CI pipelines or custom hooks.
223
200
 
224
- Use contrib <command> --help for more information about a command.
201
+ ```bash
202
+ contrib validate "📦 new: user auth module" # exit 0
203
+ contrib validate "added stuff" # exit 1
225
204
  ```
226
205
 
206
+ ---
207
+
227
208
  ## AI Features
228
209
 
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.
210
+ All AI features are powered by **GitHub Copilot** via `@github/copilot-sdk` and are entirely **optional** — every command has a manual fallback.
230
211
 
231
212
  | 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 |
213
+ |---------|------------|---------|
214
+ | `commit` | Generate commit message from staged diff | Type manually |
215
+ | `start` | Suggest branch name from natural language | Prefix picker + manual |
216
+ | `update` | Conflict resolution guidance | Standard git instructions |
217
+ | `submit` | Generate PR title and body | `gh pr create --fill` or manual |
237
218
 
238
- Use `--model <model>` on any AI-powered command to select a specific Copilot model (e.g., `gpt-4.1`, `claude-sonnet-4`).
219
+ Pass `--no-ai` to any command to skip AI entirely. Use `--model <name>` to select a specific Copilot model (e.g., `gpt-4.1`, `claude-sonnet-4`).
239
220
 
240
- ## Clean Commit Convention
221
+ ---
241
222
 
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:
223
+ ## Commit Convention Reference
243
224
 
244
- ```
245
- <emoji> <type>[!][(<scope>)]: <description>
246
- ```
225
+ ### Clean Commit *(default)*
226
+
227
+ Format: `<emoji> <type>[!][(<scope>)]: <description>`
247
228
 
248
- | Emoji | Type | Purpose |
249
- |:-----:|------|---------|
229
+ | Emoji | Type | When to use |
230
+ |:-----:|------|-------------|
250
231
  | 📦 | `new` | New features, files, or capabilities |
251
232
  | 🔧 | `update` | Changes, refactoring, improvements |
252
233
  | 🗑️ | `remove` | Removing code, files, or dependencies |
@@ -257,7 +238,54 @@ This project uses the **[Clean Commit](https://github.com/wgtechlabs/clean-commi
257
238
  | 📖 | `docs` | Documentation changes |
258
239
  | 🚀 | `release` | Version releases |
259
240
 
260
- A Husky commit-msg hook enforces this automatically.
241
+ Examples:
242
+ ```
243
+ 📦 new: user authentication system
244
+ 🔧 update (api): improve error handling
245
+ ⚙️ setup (ci): configure github actions
246
+ 🔧 update!: breaking change to config format
247
+ ```
248
+
249
+ → [Clean Commit spec](https://github.com/wgtechlabs/clean-commit)
250
+
251
+ ### Conventional Commits
252
+
253
+ Format: `<type>[!][(<scope>)]: <description>`
254
+
255
+ Types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`
256
+
257
+ Examples:
258
+ ```
259
+ feat: add user authentication
260
+ fix(auth): resolve token expiry issue
261
+ docs: update contributing guide
262
+ feat!: redesign authentication API
263
+ ```
264
+
265
+ → [conventionalcommits.org](https://www.conventionalcommits.org/)
266
+
267
+ ---
268
+
269
+ ## Config File
270
+
271
+ `contrib setup` writes `.contributerc.json` to your repo root:
272
+
273
+ ```json
274
+ {
275
+ "workflow": "clean-flow",
276
+ "commitConvention": "clean-commit",
277
+ "role": "contributor",
278
+ "mainBranch": "main",
279
+ "devBranch": "dev",
280
+ "upstream": "upstream",
281
+ "origin": "origin",
282
+ "branchPrefixes": ["feature", "fix", "docs", "chore", "test", "refactor"]
283
+ }
284
+ ```
285
+
286
+ > Add `.contributerc.json` to your `.gitignore` — it contains personal config and should not be committed.
287
+
288
+ ---
261
289
 
262
290
  ## Development
263
291
 
@@ -282,3 +310,4 @@ Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for the workfl
282
310
  ---
283
311
 
284
312
  💻💖☕ Made with ❤️ by [Waren Gonzaga](https://github.com/warengonzaga)
313
+