@traisetech/autopilot 2.3.0 → 2.5.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 (45) hide show
  1. package/CHANGELOG.md +28 -1
  2. package/README.md +215 -202
  3. package/bin/autopilot.js +9 -2
  4. package/docs/CONFIGURATION.md +103 -103
  5. package/docs/DESIGN_PRINCIPLES.md +114 -114
  6. package/docs/TEAM-MODE.md +51 -51
  7. package/docs/TROUBLESHOOTING.md +21 -21
  8. package/package.json +75 -69
  9. package/src/commands/config.js +110 -110
  10. package/src/commands/dashboard.mjs +151 -151
  11. package/src/commands/doctor.js +127 -153
  12. package/src/commands/guide.js +63 -0
  13. package/src/commands/init.js +8 -9
  14. package/src/commands/insights.js +237 -237
  15. package/src/commands/leaderboard.js +116 -116
  16. package/src/commands/pause.js +18 -18
  17. package/src/commands/preset.js +121 -121
  18. package/src/commands/resume.js +17 -17
  19. package/src/commands/start.js +41 -41
  20. package/src/commands/status.js +73 -39
  21. package/src/commands/stop.js +58 -50
  22. package/src/commands/undo.js +84 -84
  23. package/src/config/defaults.js +23 -16
  24. package/src/config/ignore.js +14 -31
  25. package/src/config/loader.js +80 -80
  26. package/src/core/commit.js +45 -52
  27. package/src/core/commitMessageGenerator.js +130 -0
  28. package/src/core/configValidator.js +92 -0
  29. package/src/core/events.js +110 -110
  30. package/src/core/focus.js +2 -1
  31. package/src/core/gemini.js +15 -15
  32. package/src/core/git.js +29 -2
  33. package/src/core/history.js +69 -69
  34. package/src/core/notifier.js +61 -0
  35. package/src/core/retryQueue.js +152 -0
  36. package/src/core/safety.js +224 -210
  37. package/src/core/state.js +69 -71
  38. package/src/core/watcher.js +193 -66
  39. package/src/index.js +70 -70
  40. package/src/utils/banner.js +6 -6
  41. package/src/utils/crypto.js +18 -18
  42. package/src/utils/identity.js +41 -41
  43. package/src/utils/logger.js +86 -68
  44. package/src/utils/paths.js +62 -62
  45. package/src/utils/process.js +141 -141
@@ -1,103 +1,103 @@
1
- # Configuration Reference - Autopilot CLI
2
-
3
- **Built by Praise Masunga (PraiseTechzw)**
4
-
5
- This document reflects the current `.autopilotrc.json` options.
6
-
7
- ---
8
-
9
- ## File Locations
10
-
11
- - Config: `.autopilotrc.json` (repo root)
12
- - Ignore: `.autopilotignore` (repo root)
13
-
14
- ---
15
-
16
- ## Full Example
17
-
18
- ```json
19
- {
20
- "debounceSeconds": 20,
21
- "minSecondsBetweenCommits": 180,
22
- "autoPush": true,
23
- "blockBranches": ["main", "master"],
24
- "requireChecks": false,
25
- "checks": ["npm test"],
26
- "commitMessageMode": "smart",
27
- "teamMode": false,
28
- "maxFileSizeMB": 50,
29
- "preventSecrets": true
30
- }
31
- ```
32
-
33
- ---
34
-
35
- ## Settings
36
-
37
- ### `debounceSeconds`
38
- - **Type:** number
39
- - **Default:** 20
40
- - **Description:** Wait time after the last file change before checking git status.
41
-
42
- ### `minSecondsBetweenCommits`
43
- - **Type:** number
44
- - **Default:** 180
45
- - **Description:** Minimum time between commits (anti-spam).
46
-
47
- ### `autoPush`
48
- - **Type:** boolean
49
- - **Default:** true
50
- - **Description:** Push to `origin/<branch>` after commit.
51
-
52
- ### `blockedBranches`
53
- - **Type:** string[]
54
- - **Default:** `["main", "master"]`
55
- - **Description:** Branches where auto-commit is disabled.
56
-
57
- ### `requireChecks`
58
- - **Type:** boolean
59
- - **Default:** false
60
- - **Description:** Run checks before commit. If any fail, commit is skipped.
61
-
62
- ### `checks`
63
- - **Type:** string[]
64
- - **Default:** `[]`
65
- - **Description:** Shell commands executed sequentially when `requireChecks` is true.
66
-
67
- ### `commitMessageMode`
68
- - **Type:** `"smart" | "simple" | "ai"`
69
- - **Default:** `"smart"`
70
- - **Description:**
71
- - smart: file/diff-based conventional messages
72
- - simple: `chore: update changes`
73
- - ai: uses configured AI provider (Gemini or Grok)
74
-
75
- ### `teamMode`
76
- - **Type:** boolean
77
- - **Default:** `false`
78
- - **Description:** Enables pull-before-push and stricter conflict handling. Recommended for collaborative environments.
79
-
80
- ### `preCommitChecks.fileSize`
81
- - **Type:** boolean
82
- - **Default:** `true`
83
- - **Description:** Prevent commits containing files larger than 50MB.
84
-
85
- ### `preCommitChecks.secrets`
86
- - **Type:** boolean
87
- - **Default:** `true`
88
- - **Description:** Secret scan for common key/token patterns before committing.
89
-
90
- ---
91
-
92
- ## Ignore File (.autopilotignore)
93
-
94
- Gitignore-style patterns. Example:
95
-
96
- ```
97
- node_modules/
98
- dist/
99
- .env
100
- *.log
101
- ```
102
-
103
- Autopilot also always ignores `.git`, `.autopilot.pid`, and `autopilot.log`.
1
+ # Configuration Reference - Autopilot CLI
2
+
3
+ **Built by Praise Masunga (PraiseTechzw)**
4
+
5
+ This document reflects the current `.autopilotrc.json` options.
6
+
7
+ ---
8
+
9
+ ## File Locations
10
+
11
+ - Config: `.autopilotrc.json` (repo root)
12
+ - Ignore: `.autopilotignore` (repo root)
13
+
14
+ ---
15
+
16
+ ## Full Example
17
+
18
+ ```json
19
+ {
20
+ "debounceSeconds": 20,
21
+ "minSecondsBetweenCommits": 180,
22
+ "autoPush": true,
23
+ "blockBranches": ["main", "master"],
24
+ "requireChecks": false,
25
+ "checks": ["npm test"],
26
+ "commitMessageMode": "smart",
27
+ "teamMode": false,
28
+ "maxFileSizeMB": 50,
29
+ "preventSecrets": true
30
+ }
31
+ ```
32
+
33
+ ---
34
+
35
+ ## Settings
36
+
37
+ ### `debounceSeconds`
38
+ - **Type:** number
39
+ - **Default:** 20
40
+ - **Description:** Wait time after the last file change before checking git status.
41
+
42
+ ### `minSecondsBetweenCommits`
43
+ - **Type:** number
44
+ - **Default:** 180
45
+ - **Description:** Minimum time between commits (anti-spam).
46
+
47
+ ### `autoPush`
48
+ - **Type:** boolean
49
+ - **Default:** true
50
+ - **Description:** Push to `origin/<branch>` after commit.
51
+
52
+ ### `blockedBranches`
53
+ - **Type:** string[]
54
+ - **Default:** `["main", "master"]`
55
+ - **Description:** Branches where auto-commit is disabled.
56
+
57
+ ### `requireChecks`
58
+ - **Type:** boolean
59
+ - **Default:** false
60
+ - **Description:** Run checks before commit. If any fail, commit is skipped.
61
+
62
+ ### `checks`
63
+ - **Type:** string[]
64
+ - **Default:** `[]`
65
+ - **Description:** Shell commands executed sequentially when `requireChecks` is true.
66
+
67
+ ### `commitMessageMode`
68
+ - **Type:** `"smart" | "simple" | "ai"`
69
+ - **Default:** `"smart"`
70
+ - **Description:**
71
+ - smart: file/diff-based conventional messages
72
+ - simple: `chore: update changes`
73
+ - ai: uses configured AI provider (Gemini or Grok)
74
+
75
+ ### `teamMode`
76
+ - **Type:** boolean
77
+ - **Default:** `false`
78
+ - **Description:** Enables pull-before-push and stricter conflict handling. Recommended for collaborative environments.
79
+
80
+ ### `preCommitChecks.fileSize`
81
+ - **Type:** boolean
82
+ - **Default:** `true`
83
+ - **Description:** Prevent commits containing files larger than 50MB.
84
+
85
+ ### `preCommitChecks.secrets`
86
+ - **Type:** boolean
87
+ - **Default:** `true`
88
+ - **Description:** Secret scan for common key/token patterns before committing.
89
+
90
+ ---
91
+
92
+ ## Ignore File (.autopilotignore)
93
+
94
+ Gitignore-style patterns. Example:
95
+
96
+ ```
97
+ node_modules/
98
+ dist/
99
+ .env
100
+ *.log
101
+ ```
102
+
103
+ Autopilot also always ignores `.git`, `.autopilot.pid`, and `autopilot.log`.
@@ -1,114 +1,114 @@
1
- # Autopilot CLI – System / Design Prompt
2
-
3
- This document serves as the design + behavior contract for Autopilot CLI. It guides internal logic, AI integrations, future contributors, and decision-making.
4
-
5
- ## Core Principles
6
-
7
- - **Autopilot CLI is a local-first, developer-trust-first Git automation tool.**
8
- - Its primary goal is to reduce Git friction without reducing developer control.
9
- - The tool must always prioritize **safety, predictability, and transparency** over convenience.
10
- - Autopilot automates repetitive Git tasks, not developer intent.
11
- - Autopilot must never surprise the user.
12
- - Autopilot must fail loudly, pause safely, and never guess during ambiguity.
13
-
14
- ## Hard Guarantees (Non-Negotiable)
15
-
16
- Autopilot will **never**:
17
-
18
- - force-push
19
- - commit ignored files
20
- - commit `.env`, secrets, or sensitive files
21
- - operate during merge or rebase states
22
- - send source code externally without explicit opt-in
23
-
24
- All automation is **reversible** via `autopilot undo`.
25
-
26
- ## Failure Behavior
27
-
28
- - If a **push fails** → pause watcher, notify user.
29
- - If **authentication expires** → pause watcher.
30
- - If **merge conflicts** are detected → stop automation.
31
- - If **network is unavailable** → queue safely or pause.
32
- - If **repository state is ambiguous** → do nothing.
33
-
34
- ## Commit Intelligence
35
-
36
- - Commit messages must:
37
- - be deterministic and explainable
38
- - reflect file-level changes
39
- - follow conventional commit standards when possible
40
- - **AI (Gemini / Grok)** is an assistant, never an authority.
41
- - AI output must be reviewable, overridable, and optional.
42
-
43
- ## Privacy & Local-First Design
44
-
45
- **Privacy Guarantees:**
46
- - Your source code **never** leaves your machine
47
- - No code diffs are transmitted externally
48
- - No file contents are sent to remote servers
49
- - AI commit message generation happens with metadata only (file paths, line counts, not actual code)
50
-
51
- **Local-First Architecture:**
52
- - Works 100% offline (except for git push operations)
53
- - No authentication to external services required
54
- - All data stored locally in your project
55
- - Configuration is local and version-controllable
56
-
57
- ## Leaderboard & Metrics
58
-
59
- - Metrics are derived **only** from local Git activity created by Autopilot.
60
- - **No raw code, diffs, or file contents are ever transmitted.**
61
- - Leaderboard data is:
62
- - opt-in (disabled by default)
63
- - anonymized or pseudonymous
64
- - explainable (users know exactly what is counted)
65
- - aggregate only (commit counts, focus time, streak days)
66
-
67
- **What gets synced (if opted in):**
68
- - ✅ Commit counts
69
- - ✅ Focus time duration
70
- - ✅ Streak days
71
- - ✅ Anonymized username/identifier
72
-
73
- **What never gets synced:**
74
- - ❌ Source code
75
- - ❌ File names or paths
76
- - ❌ Commit messages
77
- - ❌ Repository names
78
- - ❌ File diffs or changes
79
-
80
- ## User Experience Philosophy
81
-
82
- **When in Doubt: Pause, Explain, Wait**
83
-
84
- - Ambiguous situations should trigger clear, actionable error messages
85
- - Users should always understand what Autopilot is doing and why
86
- - Status messages should be informative without being verbose
87
- - Configuration should have sensible defaults but be fully customizable
88
-
89
- **Trust Through Transparency:**
90
- - Every action Autopilot takes should be logged
91
- - Users should be able to audit what happened and when
92
- - The system should explain its decisions in plain language
93
- - Documentation should be honest about limitations
94
-
95
- ## Development Guidelines
96
-
97
- **For Contributors:**
98
- - Any feature must pass the "trust test" - would you trust this with your production code?
99
- - Prefer explicit over implicit behavior
100
- - Add clear error messages for every failure case
101
- - Document why, not just what
102
- - Test edge cases extensively, especially around git state
103
-
104
- **For AI Integration:**
105
- - AI should enhance, not replace, developer judgment
106
- - All AI suggestions must be reviewable before commit
107
- - Provide escape hatches for AI-generated content
108
- - Log AI usage for transparency
109
- - Allow disabling AI features entirely
110
-
111
- ---
112
-
113
- *Any feature (including Grok or leaderboards) must pass this test: Does it maintain developer trust, safety, and control?*
114
-
1
+ # Autopilot CLI – System / Design Prompt
2
+
3
+ This document serves as the design + behavior contract for Autopilot CLI. It guides internal logic, AI integrations, future contributors, and decision-making.
4
+
5
+ ## Core Principles
6
+
7
+ - **Autopilot CLI is a local-first, developer-trust-first Git automation tool.**
8
+ - Its primary goal is to reduce Git friction without reducing developer control.
9
+ - The tool must always prioritize **safety, predictability, and transparency** over convenience.
10
+ - Autopilot automates repetitive Git tasks, not developer intent.
11
+ - Autopilot must never surprise the user.
12
+ - Autopilot must fail loudly, pause safely, and never guess during ambiguity.
13
+
14
+ ## Hard Guarantees (Non-Negotiable)
15
+
16
+ Autopilot will **never**:
17
+
18
+ - force-push
19
+ - commit ignored files
20
+ - commit `.env`, secrets, or sensitive files
21
+ - operate during merge or rebase states
22
+ - send source code externally without explicit opt-in
23
+
24
+ All automation is **reversible** via `autopilot undo`.
25
+
26
+ ## Failure Behavior
27
+
28
+ - If a **push fails** → pause watcher, notify user.
29
+ - If **authentication expires** → pause watcher.
30
+ - If **merge conflicts** are detected → stop automation.
31
+ - If **network is unavailable** → queue safely or pause.
32
+ - If **repository state is ambiguous** → do nothing.
33
+
34
+ ## Commit Intelligence
35
+
36
+ - Commit messages must:
37
+ - be deterministic and explainable
38
+ - reflect file-level changes
39
+ - follow conventional commit standards when possible
40
+ - **AI (Gemini / Grok)** is an assistant, never an authority.
41
+ - AI output must be reviewable, overridable, and optional.
42
+
43
+ ## Privacy & Local-First Design
44
+
45
+ **Privacy Guarantees:**
46
+ - Your source code **never** leaves your machine
47
+ - No code diffs are transmitted externally
48
+ - No file contents are sent to remote servers
49
+ - AI commit message generation happens with metadata only (file paths, line counts, not actual code)
50
+
51
+ **Local-First Architecture:**
52
+ - Works 100% offline (except for git push operations)
53
+ - No authentication to external services required
54
+ - All data stored locally in your project
55
+ - Configuration is local and version-controllable
56
+
57
+ ## Leaderboard & Metrics
58
+
59
+ - Metrics are derived **only** from local Git activity created by Autopilot.
60
+ - **No raw code, diffs, or file contents are ever transmitted.**
61
+ - Leaderboard data is:
62
+ - opt-in (disabled by default)
63
+ - anonymized or pseudonymous
64
+ - explainable (users know exactly what is counted)
65
+ - aggregate only (commit counts, focus time, streak days)
66
+
67
+ **What gets synced (if opted in):**
68
+ - ✅ Commit counts
69
+ - ✅ Focus time duration
70
+ - ✅ Streak days
71
+ - ✅ Anonymized username/identifier
72
+
73
+ **What never gets synced:**
74
+ - ❌ Source code
75
+ - ❌ File names or paths
76
+ - ❌ Commit messages
77
+ - ❌ Repository names
78
+ - ❌ File diffs or changes
79
+
80
+ ## User Experience Philosophy
81
+
82
+ **When in Doubt: Pause, Explain, Wait**
83
+
84
+ - Ambiguous situations should trigger clear, actionable error messages
85
+ - Users should always understand what Autopilot is doing and why
86
+ - Status messages should be informative without being verbose
87
+ - Configuration should have sensible defaults but be fully customizable
88
+
89
+ **Trust Through Transparency:**
90
+ - Every action Autopilot takes should be logged
91
+ - Users should be able to audit what happened and when
92
+ - The system should explain its decisions in plain language
93
+ - Documentation should be honest about limitations
94
+
95
+ ## Development Guidelines
96
+
97
+ **For Contributors:**
98
+ - Any feature must pass the "trust test" - would you trust this with your production code?
99
+ - Prefer explicit over implicit behavior
100
+ - Add clear error messages for every failure case
101
+ - Document why, not just what
102
+ - Test edge cases extensively, especially around git state
103
+
104
+ **For AI Integration:**
105
+ - AI should enhance, not replace, developer judgment
106
+ - All AI suggestions must be reviewable before commit
107
+ - Provide escape hatches for AI-generated content
108
+ - Log AI usage for transparency
109
+ - Allow disabling AI features entirely
110
+
111
+ ---
112
+
113
+ *Any feature (including Grok or leaderboards) must pass this test: Does it maintain developer trust, safety, and control?*
114
+
package/docs/TEAM-MODE.md CHANGED
@@ -1,51 +1,51 @@
1
- # 👥 Team Mode
2
-
3
- Autopilot V2 introduces **Team Mode**, designed to make automated Git workflows safe and efficient for collaborative environments.
4
-
5
- ## How it Works
6
-
7
- When `teamMode` is enabled in your configuration, Autopilot changes its behavior to prioritize synchronization and conflict prevention.
8
-
9
- ### Key Behaviors
10
-
11
- 1. **Pull-Before-Push**:
12
- Before attempting to push any local commits, Autopilot automatically runs `git pull --rebase`. This ensures your local branch is up-to-date with the remote, minimizing merge conflicts.
13
-
14
- 2. **Conflict Abortion**:
15
- If a pull operation detects conflicts, Autopilot **immediately aborts** the automation loop. It will not attempt to commit or push until you manually resolve the conflicts.
16
- - **Status**: The watcher enters a "Stopped" or error state.
17
- - **Notification**: You will see an error message in the logs/dashboard.
18
-
19
- 3. **Remote Status Checks**:
20
- Autopilot frequently checks the remote repository status to detect if your local branch has diverged.
21
-
22
- ## Enabling Team Mode
23
-
24
- To enable Team Mode, run:
25
-
26
- ```bash
27
- autopilot init
28
- ```
29
- And select "Yes" when asked "Enable team mode? (pull before push)".
30
-
31
- Or manually edit your `.autopilotrc.json`:
32
-
33
- ```json
34
- {
35
- "teamMode": true
36
- }
37
- ```
38
-
39
- ## Best Practices for Teams
40
-
41
- - **Short Commit Intervals**: Set `commitInterval` to a lower value (e.g., 5-10 minutes) to reduce the chance of large conflicts.
42
- - **Feature Branches**: Continue to use feature branches (`feat/my-feature`). Autopilot works best on feature branches, leaving `main` or `develop` protected.
43
- - **Dashboard Monitoring**: Use `autopilot dashboard` to keep an eye on the automation status and pending changes.
44
-
45
- ## Troubleshooting
46
-
47
- If Autopilot stops due to a conflict:
48
- 1. Run `git status` to see the conflict.
49
- 2. Resolve the conflicts manually.
50
- 3. Run `git add .` and `git rebase --continue`.
51
- 4. Restart Autopilot with `autopilot start`.
1
+ # 👥 Team Mode
2
+
3
+ Autopilot V2 introduces **Team Mode**, designed to make automated Git workflows safe and efficient for collaborative environments.
4
+
5
+ ## How it Works
6
+
7
+ When `teamMode` is enabled in your configuration, Autopilot changes its behavior to prioritize synchronization and conflict prevention.
8
+
9
+ ### Key Behaviors
10
+
11
+ 1. **Pull-Before-Push**:
12
+ Before attempting to push any local commits, Autopilot automatically runs `git pull --rebase`. This ensures your local branch is up-to-date with the remote, minimizing merge conflicts.
13
+
14
+ 2. **Conflict Abortion**:
15
+ If a pull operation detects conflicts, Autopilot **immediately aborts** the automation loop. It will not attempt to commit or push until you manually resolve the conflicts.
16
+ - **Status**: The watcher enters a "Stopped" or error state.
17
+ - **Notification**: You will see an error message in the logs/dashboard.
18
+
19
+ 3. **Remote Status Checks**:
20
+ Autopilot frequently checks the remote repository status to detect if your local branch has diverged.
21
+
22
+ ## Enabling Team Mode
23
+
24
+ To enable Team Mode, run:
25
+
26
+ ```bash
27
+ autopilot init
28
+ ```
29
+ And select "Yes" when asked "Enable team mode? (pull before push)".
30
+
31
+ Or manually edit your `.autopilotrc.json`:
32
+
33
+ ```json
34
+ {
35
+ "teamMode": true
36
+ }
37
+ ```
38
+
39
+ ## Best Practices for Teams
40
+
41
+ - **Short Commit Intervals**: Set `commitInterval` to a lower value (e.g., 5-10 minutes) to reduce the chance of large conflicts.
42
+ - **Feature Branches**: Continue to use feature branches (`feat/my-feature`). Autopilot works best on feature branches, leaving `main` or `develop` protected.
43
+ - **Dashboard Monitoring**: Use `autopilot dashboard` to keep an eye on the automation status and pending changes.
44
+
45
+ ## Troubleshooting
46
+
47
+ If Autopilot stops due to a conflict:
48
+ 1. Run `git status` to see the conflict.
49
+ 2. Resolve the conflicts manually.
50
+ 3. Run `git add .` and `git rebase --continue`.
51
+ 4. Restart Autopilot with `autopilot start`.
@@ -1,21 +1,21 @@
1
- # TROUBLESHOOTING
2
-
3
- ## Common Issues
4
-
5
- ### Watcher Loop / High CPU Usage (Windows)
6
- If Autopilot seems to be constantly triggering or consuming high CPU on Windows, it is likely due to "noisy" files that change frequently but should be ignored.
7
-
8
- **Common Culprits:**
9
- - `.vscode/time-analytics.json`: Some VS Code extensions write to this file constantly.
10
- - `autopilot.log`: If the watcher logs to a file that it is also watching, it creates a feedback loop.
11
-
12
- **Solution:**
13
- Autopilot v0.1.4+ includes enhanced Windows path handling to automatically ignore these files. If you still see issues:
14
- 1. Ensure `.vscode/` and `*.log` are in your `.autopilotignore` file.
15
- 2. Run `autopilot doctor` to verify your configuration.
16
-
17
- ### "git.status is not a function"
18
- This was a known issue in older versions. Please upgrade to the latest version.
19
-
20
- ### Permissions Errors
21
- Ensure you have write access to the repository and that no other process has locked the files (common on Windows with anti-virus software).
1
+ # TROUBLESHOOTING
2
+
3
+ ## Common Issues
4
+
5
+ ### Watcher Loop / High CPU Usage (Windows)
6
+ If Autopilot seems to be constantly triggering or consuming high CPU on Windows, it is likely due to "noisy" files that change frequently but should be ignored.
7
+
8
+ **Common Culprits:**
9
+ - `.vscode/time-analytics.json`: Some VS Code extensions write to this file constantly.
10
+ - `autopilot.log`: If the watcher logs to a file that it is also watching, it creates a feedback loop.
11
+
12
+ **Solution:**
13
+ Autopilot v0.1.4+ includes enhanced Windows path handling to automatically ignore these files. If you still see issues:
14
+ 1. Ensure `.vscode/` and `*.log` are in your `.autopilotignore` file.
15
+ 2. Run `autopilot doctor` to verify your configuration.
16
+
17
+ ### "git.status is not a function"
18
+ This was a known issue in older versions. Please upgrade to the latest version.
19
+
20
+ ### Permissions Errors
21
+ Ensure you have write access to the repository and that no other process has locked the files (common on Windows with anti-virus software).