@searls/turbocommit 0.10.2 → 0.11.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.
- package/README.md +6 -0
- package/lib/git.js +11 -1
- package/lib/run.js +9 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -136,6 +136,12 @@ Here's every property with its default:
|
|
|
136
136
|
// "Name <email>" → custom trailer value
|
|
137
137
|
"coauthor": true,
|
|
138
138
|
|
|
139
|
+
// Auto-push after each turbocommit.
|
|
140
|
+
// Only pushes when fast-forward is possible (never forces).
|
|
141
|
+
// true → push after each commit
|
|
142
|
+
// false → don't push (default)
|
|
143
|
+
"push": false,
|
|
144
|
+
|
|
139
145
|
"title": {
|
|
140
146
|
// "agent" (default) → run a title agent to generate the headline
|
|
141
147
|
// "transcript" → extract the first prompt as the headline
|
package/lib/git.js
CHANGED
|
@@ -56,6 +56,15 @@ function currentBranch (cwd) {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
function pushClean (cwd) {
|
|
60
|
+
try {
|
|
61
|
+
git('push', { cwd })
|
|
62
|
+
return true
|
|
63
|
+
} catch {
|
|
64
|
+
return false
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
59
68
|
function esc (s) {
|
|
60
69
|
return s.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\$/g, '\\$').replace(/`/g, '\\`')
|
|
61
70
|
}
|
|
@@ -66,5 +75,6 @@ module.exports = {
|
|
|
66
75
|
hasChanges,
|
|
67
76
|
addAndCommit,
|
|
68
77
|
hasCommits,
|
|
69
|
-
currentBranch
|
|
78
|
+
currentBranch,
|
|
79
|
+
pushClean
|
|
70
80
|
}
|
package/lib/run.js
CHANGED
|
@@ -4,7 +4,7 @@ const path = require('path')
|
|
|
4
4
|
const { loadJson, mergeConfig } = require('./io')
|
|
5
5
|
const { parseTranscript, formatBody, formatTitleTranscript, extractHeadline, extractModel } = require('./transcript')
|
|
6
6
|
const { runTitleAgent, runBodyAgent } = require('./agent')
|
|
7
|
-
const { gitRoot, hasChanges, addAndCommit, hasCommits, currentBranch } = require('./git')
|
|
7
|
+
const { gitRoot, hasChanges, addAndCommit, hasCommits, currentBranch, pushClean } = require('./git')
|
|
8
8
|
const { logEvent } = require('./log')
|
|
9
9
|
const { wrapText } = require('./wrap')
|
|
10
10
|
const { hasTrackedModifications, cleanupTracking } = require('./track')
|
|
@@ -191,6 +191,14 @@ function run (input) {
|
|
|
191
191
|
|
|
192
192
|
logEvent('success', { project, branch, context, title: headline })
|
|
193
193
|
|
|
194
|
+
if (config.push === true) {
|
|
195
|
+
if (pushClean(root)) {
|
|
196
|
+
logEvent('push', { project, branch })
|
|
197
|
+
} else {
|
|
198
|
+
logEvent('push-fail', { project, branch })
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
194
202
|
// Post-commit: save watermark and cleanup
|
|
195
203
|
if (sessionId) {
|
|
196
204
|
saveWatermark(root, sessionId, pairs.length, sha)
|