@traisetech/autopilot 0.1.3
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/CHANGELOG.md +17 -0
- package/LICENSE +22 -0
- package/README.md +210 -0
- package/bin/autopilot.js +48 -0
- package/docs/ARCHITECTURE.md +534 -0
- package/docs/CONFIGURATION.md +82 -0
- package/docs/CONTRIBUTING.md +47 -0
- package/docs/DESIGN_DELIVERY.md +441 -0
- package/docs/DESIGN_SUMMARY.md +61 -0
- package/docs/EXTENDING.md +69 -0
- package/docs/SAFETY-FEATURES.md +56 -0
- package/docs/START_HERE.md +41 -0
- package/docs/TROUBLESHOOTING.md +40 -0
- package/package.json +59 -0
- package/src/commands/doctor.js +121 -0
- package/src/commands/init.js +92 -0
- package/src/commands/start.js +41 -0
- package/src/commands/status.js +56 -0
- package/src/commands/stop.js +50 -0
- package/src/config/defaults.js +34 -0
- package/src/config/ignore.js +37 -0
- package/src/config/loader.js +47 -0
- package/src/core/commit.js +116 -0
- package/src/core/git.js +154 -0
- package/src/core/safety.js +38 -0
- package/src/core/watcher.js +309 -0
- package/src/index.js +50 -0
- package/src/utils/banner.js +6 -0
- package/src/utils/logger.js +49 -0
- package/src/utils/paths.js +59 -0
- package/src/utils/process.js +141 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
## v0.1.1 – Package Hygiene
|
|
2
|
+
|
|
3
|
+
### Fixed
|
|
4
|
+
- Resolved npm publish warnings by adding `files` whitelist
|
|
5
|
+
- Renamed package to scoped `@praisetechzw/autopilot`
|
|
6
|
+
- Excluded unnecessary development files from distribution
|
|
7
|
+
|
|
8
|
+
## v0.1.0 – Initial Release
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Intelligent auto commit & push
|
|
12
|
+
- Branch protection (main/master blocked)
|
|
13
|
+
- Remote-ahead safety checks
|
|
14
|
+
- Smart conventional commit messages
|
|
15
|
+
- Per-repo config and ignore rules
|
|
16
|
+
|
|
17
|
+
Built by Praise Masunga (PraiseTechzw).
|
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Praise Masunga (PraiseTech)
|
|
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.
|
|
22
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
# 🚀 Autopilot CLI
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
**Intelligent Git automation that commits and pushes your code, so you can focus on building.**
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/autopilot-cli)
|
|
10
|
+
[](https://opensource.org/licenses/MIT)
|
|
11
|
+
[](https://nodejs.org)
|
|
12
|
+
[](https://www.npmjs.com/package/autopilot-cli)
|
|
13
|
+
[](https://github.com/PraiseTechzw/autopilot-cli/stargazers)
|
|
14
|
+
[](https://github.com/PraiseTechzw/autopilot-cli/actions)
|
|
15
|
+
[](http://makeapullrequest.com)
|
|
16
|
+
|
|
17
|
+
**Built by [Praise Masunga](https://github.com/PraiseTechzw) (PraiseTechzw)**
|
|
18
|
+
|
|
19
|
+
[Features](#-features) • [Quick Start](#-quick-start) • [Configuration](#-configuration) • [Commands](#-commands) • [Safety](#-safety-features)
|
|
20
|
+
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 📖 Table of Contents
|
|
26
|
+
|
|
27
|
+
- [Why Autopilot?](#-why-autopilot)
|
|
28
|
+
- [Features](#-features)
|
|
29
|
+
- [Quick Start](#-quick-start)
|
|
30
|
+
- [Installation](#-installation)
|
|
31
|
+
- [Commands](#-commands)
|
|
32
|
+
- [Configuration](#-configuration)
|
|
33
|
+
- [Safety Features](#-safety-features)
|
|
34
|
+
- [Troubleshooting](#-troubleshooting)
|
|
35
|
+
- [Contributing](#-contributing)
|
|
36
|
+
- [License](#-license)
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 🎯 Why Autopilot?
|
|
41
|
+
|
|
42
|
+
<table>
|
|
43
|
+
<tr>
|
|
44
|
+
<td width="50%">
|
|
45
|
+
|
|
46
|
+
### ❌ Before Autopilot
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Every. Single. Time.
|
|
50
|
+
git add .
|
|
51
|
+
git commit -m "update stuff"
|
|
52
|
+
git push
|
|
53
|
+
|
|
54
|
+
# Repeat 50+ times a day...
|
|
55
|
+
# Lose focus on coding
|
|
56
|
+
# Forget to commit
|
|
57
|
+
# Inconsistent messages
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
</td>
|
|
61
|
+
<td width="50%">
|
|
62
|
+
|
|
63
|
+
### ✅ With Autopilot
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# One time setup
|
|
67
|
+
autopilot init
|
|
68
|
+
autopilot start
|
|
69
|
+
|
|
70
|
+
# That's it!
|
|
71
|
+
# Focus on coding
|
|
72
|
+
# Auto-commits with smart messages
|
|
73
|
+
# Never lose work again
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
</td>
|
|
77
|
+
</tr>
|
|
78
|
+
</table>
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## ✨ Features
|
|
83
|
+
|
|
84
|
+
- **🧠 Smart Commits**: Generates professional conventional commit messages automatically.
|
|
85
|
+
- **⚡ Watcher Engine**: Real-time file monitoring with smart debouncing using `chokidar`.
|
|
86
|
+
- **🛡️ Safety First**: Blocks commits on protected branches and checks remote status.
|
|
87
|
+
- **🔄 Automated Flow**: Fetches, stages, commits, and pushes (optional) automatically.
|
|
88
|
+
- **⚙️ Zero Config**: Works out of the box, but fully configurable via `.autopilotrc.json`.
|
|
89
|
+
- **🩺 Self-Healing**: Includes a `doctor` command to diagnose and fix issues.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## 🚀 Quick Start
|
|
94
|
+
|
|
95
|
+
### Installation
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# Install globally via npm
|
|
99
|
+
npm install -g autopilot-cli
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Usage
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# 1. Initialize in your project
|
|
106
|
+
cd my-project
|
|
107
|
+
autopilot init
|
|
108
|
+
|
|
109
|
+
# 2. Start the background watcher
|
|
110
|
+
autopilot start
|
|
111
|
+
|
|
112
|
+
# 3. Check status
|
|
113
|
+
autopilot status
|
|
114
|
+
|
|
115
|
+
# 4. Stop when done
|
|
116
|
+
autopilot stop
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## 💻 Commands
|
|
122
|
+
|
|
123
|
+
| Command | Description |
|
|
124
|
+
|---------|-------------|
|
|
125
|
+
| `autopilot init` | Initializes configuration and ignore files in the current directory. |
|
|
126
|
+
| `autopilot start` | Starts the background watcher daemon. |
|
|
127
|
+
| `autopilot stop` | Stops the running watcher daemon. |
|
|
128
|
+
| `autopilot status` | Shows the current status of the watcher process. |
|
|
129
|
+
| `autopilot doctor` | Runs diagnostics to verify environment and configuration. |
|
|
130
|
+
| `autopilot --help` | Displays help information. |
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## ⚙️ Configuration
|
|
135
|
+
|
|
136
|
+
Autopilot uses a `.autopilotrc.json` file for configuration.
|
|
137
|
+
|
|
138
|
+
```json
|
|
139
|
+
{
|
|
140
|
+
"minInterval": 30,
|
|
141
|
+
"autoPush": true,
|
|
142
|
+
"blockedBranches": ["main", "production"],
|
|
143
|
+
"requireChecks": false,
|
|
144
|
+
"ignore": [
|
|
145
|
+
"*.log",
|
|
146
|
+
"temp/",
|
|
147
|
+
"dist/",
|
|
148
|
+
"node_modules"
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
| Option | Type | Default | Description |
|
|
154
|
+
|--------|------|---------|-------------|
|
|
155
|
+
| `minInterval` | `number` | `30` | Minimum seconds between commits. |
|
|
156
|
+
| `autoPush` | `boolean` | `true` | Whether to push changes automatically after commit. |
|
|
157
|
+
| `blockedBranches` | `array` | `[]` | List of branches to disable auto-commit on. |
|
|
158
|
+
| `requireChecks` | `boolean` | `false` | Run custom checks before committing. |
|
|
159
|
+
| `ignore` | `array` | `[]` | Additional glob patterns to ignore. |
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## 🛡️ Safety Features
|
|
164
|
+
|
|
165
|
+
Autopilot includes several safety mechanisms to prevent accidents:
|
|
166
|
+
|
|
167
|
+
1. **Branch Protection**: Will not run on branches listed in `blockedBranches`.
|
|
168
|
+
2. **Remote Sync**: Checks if local branch is behind remote before acting.
|
|
169
|
+
3. **Debouncing**: Waits for file changes to settle before committing.
|
|
170
|
+
4. **PID Management**: Ensures only one instance runs per repository.
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## 🔧 Troubleshooting
|
|
175
|
+
|
|
176
|
+
If you encounter issues, run the doctor command:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
autopilot doctor
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
This will check for:
|
|
183
|
+
- Git repository status
|
|
184
|
+
- Configuration validity
|
|
185
|
+
- Node.js version
|
|
186
|
+
- Permissions
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## 🤝 Contributing
|
|
191
|
+
|
|
192
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
193
|
+
|
|
194
|
+
1. Fork the repository
|
|
195
|
+
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
|
|
196
|
+
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
|
|
197
|
+
4. Push to the branch (`git push origin feature/AmazingFeature`)
|
|
198
|
+
5. Open a Pull Request
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## 📜 License
|
|
203
|
+
|
|
204
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
<div align="center">
|
|
209
|
+
<b>Built with ❤️ by <a href="https://github.com/PraiseTechzw">Praise Masunga (PraiseTechzw)</a></b>
|
|
210
|
+
</div>
|
package/bin/autopilot.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { Command } = require('commander');
|
|
4
|
+
const { initRepo } = require('../src/commands/init');
|
|
5
|
+
const { startWatcher } = require('../src/commands/start');
|
|
6
|
+
const { stopWatcher } = require('../src/commands/stop');
|
|
7
|
+
const { statusWatcher } = require('../src/commands/status');
|
|
8
|
+
const { doctor } = require('../src/commands/doctor');
|
|
9
|
+
const pkg = require('../package.json');
|
|
10
|
+
|
|
11
|
+
const program = new Command();
|
|
12
|
+
|
|
13
|
+
program
|
|
14
|
+
.name('autopilot')
|
|
15
|
+
.description('Git automation with safety rails')
|
|
16
|
+
.version(pkg.version, '-v, --version', 'Show version');
|
|
17
|
+
|
|
18
|
+
program
|
|
19
|
+
.command('init')
|
|
20
|
+
.description('Initialize autopilot configuration in repository')
|
|
21
|
+
.action(initRepo);
|
|
22
|
+
|
|
23
|
+
program
|
|
24
|
+
.command('start')
|
|
25
|
+
.description('Start autopilot watcher in foreground')
|
|
26
|
+
.action(startWatcher);
|
|
27
|
+
|
|
28
|
+
program
|
|
29
|
+
.command('stop')
|
|
30
|
+
.description('Stop the running autopilot watcher')
|
|
31
|
+
.action(stopWatcher);
|
|
32
|
+
|
|
33
|
+
program
|
|
34
|
+
.command('status')
|
|
35
|
+
.description('Show autopilot watcher status')
|
|
36
|
+
.action(statusWatcher);
|
|
37
|
+
|
|
38
|
+
program
|
|
39
|
+
.command('doctor')
|
|
40
|
+
.description('Diagnose and validate autopilot setup')
|
|
41
|
+
.action(doctor);
|
|
42
|
+
|
|
43
|
+
program
|
|
44
|
+
.addHelpText('after', '\nBuilt by Praise Masunga (PraiseTechzw)')
|
|
45
|
+
.addHelpCommand(true, 'Show help for command')
|
|
46
|
+
.showHelpAfterError('(add --help for command information)');
|
|
47
|
+
|
|
48
|
+
program.parse(process.argv);
|