nearly-cli 0.1.16 → 0.1.17
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nearly-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"description": "A pull request tells you what changed. Nearly tells you what nearly happened: the commands a human refused, the pushes policy blocked, the turns rolled back.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/scripts/doctor.mjs
CHANGED
|
@@ -187,10 +187,14 @@ if (runs) {
|
|
|
187
187
|
|
|
188
188
|
// 5 — the hook that offers the record at push time
|
|
189
189
|
const pushHook = join(repo, '.git', 'hooks', 'pre-push');
|
|
190
|
-
const
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
190
|
+
const pushText = (() => { try { return readFileSync(pushHook, 'utf8'); } catch { return null; } })();
|
|
191
|
+
// A pre-push hook of the person's own (husky, lefthook, a script) makes install
|
|
192
|
+
// refuse to overwrite it, so "run nearly" would send them round in a circle.
|
|
193
|
+
const hasPush = !!pushText && /x-session-record-hook|push-record/.test(pushText);
|
|
194
|
+
if (hasPush) say(true, 'pre-push hook', 'installed');
|
|
195
|
+
else if (pushText != null) say(false, 'pre-push hook', 'yours is there, without Nearly in it',
|
|
196
|
+
'your own pre-push hook was left alone — add `nearly push-record "$(git rev-parse --show-toplevel)" || true` to it');
|
|
197
|
+
else say(false, 'pre-push hook', 'missing', 'run `nearly` here to install it');
|
|
194
198
|
|
|
195
199
|
// 6 — gh, which is how a pull request is found and commented on. Its absence
|
|
196
200
|
// used to be reported as "no pull request yet", which sent people off to raise
|
|
@@ -63,7 +63,7 @@ if (existsSync(hookPath)) {
|
|
|
63
63
|
const existing = readFileSync(hookPath, 'utf8');
|
|
64
64
|
const mine = ours(existing);
|
|
65
65
|
if (!mine) {
|
|
66
|
-
console.error(`${hookPath} already exists and was not written by
|
|
66
|
+
console.error(`${hookPath} already exists and was not written by Nearly.`);
|
|
67
67
|
console.error('Refusing to overwrite it. Move it aside, or add this line to it yourself:');
|
|
68
68
|
console.error(` ${RUN} push-record "${repo}" || true`);
|
|
69
69
|
process.exit(1);
|