@navbook/cli 0.3.0 → 0.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 (78) hide show
  1. package/dist/args.d.ts +28 -0
  2. package/dist/args.js +48 -0
  3. package/dist/args.js.map +1 -0
  4. package/dist/commands/complete.d.ts +10 -0
  5. package/dist/commands/complete.js +59 -51
  6. package/dist/commands/complete.js.map +1 -1
  7. package/dist/commands/compose.d.ts +35 -0
  8. package/dist/commands/doctor.d.ts +15 -0
  9. package/dist/commands/entity.d.ts +73 -0
  10. package/dist/commands/entity.js +59 -44
  11. package/dist/commands/entity.js.map +1 -1
  12. package/dist/commands/init.d.ts +11 -0
  13. package/dist/commands/install.d.ts +17 -0
  14. package/dist/commands/install.js +6 -3
  15. package/dist/commands/install.js.map +1 -1
  16. package/dist/commands/issue.d.ts +35 -0
  17. package/dist/commands/issue.js +4 -5
  18. package/dist/commands/issue.js.map +1 -1
  19. package/dist/commands/plugin.d.ts +36 -0
  20. package/dist/commands/plugin.js +386 -0
  21. package/dist/commands/plugin.js.map +1 -0
  22. package/dist/commands/policy.d.ts +58 -0
  23. package/dist/commands/policy.js +28 -2
  24. package/dist/commands/policy.js.map +1 -1
  25. package/dist/commands/pr-elsewhere.d.ts +40 -0
  26. package/dist/commands/pr-elsewhere.js +209 -0
  27. package/dist/commands/pr-elsewhere.js.map +1 -0
  28. package/dist/commands/pr.d.ts +69 -0
  29. package/dist/commands/pr.js +132 -68
  30. package/dist/commands/pr.js.map +1 -1
  31. package/dist/context.d.ts +42 -0
  32. package/dist/context.js +2 -0
  33. package/dist/context.js.map +1 -1
  34. package/dist/editor.d.ts +23 -0
  35. package/dist/editor.js +4 -0
  36. package/dist/editor.js.map +1 -1
  37. package/dist/errors.d.ts +17 -0
  38. package/dist/install/completions.d.ts +19 -0
  39. package/dist/install/hook.d.ts +32 -0
  40. package/dist/install/hook.js +48 -4
  41. package/dist/install/hook.js.map +1 -1
  42. package/dist/main.d.ts +21 -0
  43. package/dist/main.js +112 -8
  44. package/dist/main.js.map +1 -1
  45. package/dist/plugins/commands.d.ts +69 -0
  46. package/dist/plugins/commands.js +148 -0
  47. package/dist/plugins/commands.js.map +1 -0
  48. package/dist/plugins/hint.d.ts +23 -0
  49. package/dist/plugins/hint.js +65 -0
  50. package/dist/plugins/hint.js.map +1 -0
  51. package/dist/plugins/host.d.ts +125 -0
  52. package/dist/plugins/host.js +18 -0
  53. package/dist/plugins/host.js.map +1 -0
  54. package/dist/plugins/loader.d.ts +54 -0
  55. package/dist/plugins/loader.js +165 -0
  56. package/dist/plugins/loader.js.map +1 -0
  57. package/dist/plugins/resolve.d.ts +50 -0
  58. package/dist/plugins/resolve.js +134 -0
  59. package/dist/plugins/resolve.js.map +1 -0
  60. package/dist/plugins/runtime.d.ts +69 -0
  61. package/dist/plugins/runtime.js +256 -0
  62. package/dist/plugins/runtime.js.map +1 -0
  63. package/dist/plugins/store.d.ts +96 -0
  64. package/dist/plugins/store.js +186 -0
  65. package/dist/plugins/store.js.map +1 -0
  66. package/dist/program.d.ts +49 -0
  67. package/dist/program.js +353 -114
  68. package/dist/program.js.map +1 -1
  69. package/dist/prompt.d.ts +31 -0
  70. package/dist/render/colors.d.ts +13 -0
  71. package/dist/render/detail.d.ts +22 -0
  72. package/dist/render/table.d.ts +32 -0
  73. package/dist/render/table.js +123 -13
  74. package/dist/render/table.js.map +1 -1
  75. package/dist/sort.d.ts +27 -0
  76. package/package.json +9 -2
  77. package/dist/commands/feature.js +0 -202
  78. package/dist/commands/feature.js.map +0 -1
@@ -6,12 +6,13 @@
6
6
  * parts of the shared verbs that must reach across branches, because a PR's
7
7
  * files live on the branch it proposes to merge (spec 03 §3.5).
8
8
  */
9
- import { applyComment, bindReviewRevision, commitReport, continuePrMerge, countOpenPrsOnOtherRefs, currentAuthor, entityJson, executePrMerge, findPrToWrite, listEntities, listPrsAcrossRefs, materializePrIfAbsent, newCommentFile, newPrFile, openPr, parseListQuery, parsePerson, planPrMerge, preparePrOpen, readReviewers, readReviewPolicy, requestReview, reviewSummary, sameEmail, stringField, toNdjson, updatePr, validateComment, validatePr, } from "@navbook/core";
9
+ import { applyComment, bindReviewRevision, commitReport, continuePrMerge, countOpenPrsOnOtherRefs, currentAuthor, entityJson, executePrMerge, isMergeMethod, listEntities, listPrsAcrossRefs, MERGE_METHODS, materializePrIfAbsent, newCommentFile, newPrFile, openPr, parseListQuery, parsePerson, planPrMerge, preparePrOpen, readReviewers, readReviewPolicy, requestReview, reviewSummary, sameEmail, stringField, toNdjson, updatePr, validateComment, validatePr, } from "@navbook/core";
10
10
  import { fail } from "../errors.js";
11
11
  import { askYesNo, isInteractive } from "../prompt.js";
12
12
  import { composeFile } from "./compose.js";
13
13
  import { cmdClose, reportList, } from "./entity.js";
14
- import { describeShortfall, mergeAction, warnPolicyProblems } from "./policy.js";
14
+ import { describeShortfall, mergeAction, warnMergePolicyProblems, warnPolicyProblems, } from "./policy.js";
15
+ import { withPrWriteSite } from "./pr-elsewhere.js";
15
16
  export function cmdPrOpen(ctx, opts) {
16
17
  const draft = preparePrOpen(ctx, { target: opts.target, title: opts.title });
17
18
  const composed = composeFile(ctx, {
@@ -31,9 +32,9 @@ export function cmdPrOpen(ctx, opts) {
31
32
  labels: opts.label,
32
33
  assignee: opts.assignee,
33
34
  milestone: opts.milestone,
34
- features: opts.feature,
35
+ ...(opts.ext ? { ext: opts.ext } : {}),
35
36
  }),
36
- validate: validatePr,
37
+ validate: (parsed) => validatePr(parsed, ctx.ext),
37
38
  });
38
39
  const { id, dirPath, run } = openPr(ctx, { content: composed.content, fallbackTitle: draft.title }, { commit: opts.commit });
39
40
  ctx.stdout.write(`Created ${ctx.navDir}/${dirPath}/ (#${id})\n`);
@@ -41,72 +42,83 @@ export function cmdPrOpen(ctx, opts) {
41
42
  if (opts.commit)
42
43
  ctx.stdout.write(`${commitReport(run)}\n`);
43
44
  }
44
- /* ------------------------------------------------------------------- update */
45
45
  export function cmdPrUpdate(ctx, prefix, opts) {
46
- const { entity, head, revisionCount, run } = updatePr(ctx, prefix, { commit: opts.commit });
47
- ctx.stdout.write(`Recorded revision ${revisionCount} of #${entity.id} head ${head.slice(0, 12)}\n`);
48
- if (opts.commit)
49
- ctx.stdout.write(`${commitReport(run)}\n`);
46
+ // The revision pinned is the HEAD of wherever this runs, so moving the write
47
+ // to a worktree on the source branch is what pins the right one — this
48
+ // checkout's HEAD was never the head under review.
49
+ withPrWriteSite(ctx, prefix, opts, (at) => {
50
+ const { entity, head, revisionCount, run } = updatePr(at, prefix, { commit: opts.commit });
51
+ ctx.stdout.write(`Recorded revision ${revisionCount} of #${entity.id} head ${head.slice(0, 12)}\n`);
52
+ if (opts.commit)
53
+ ctx.stdout.write(`${commitReport(run)}\n`);
54
+ });
50
55
  }
51
56
  export function cmdPrRequest(ctx, prefix, people, opts) {
52
- const { entity, changed, unchanged, run } = requestReview(ctx, prefix, people, {
53
- commit: opts.commit,
54
- remove: opts.remove,
57
+ withPrWriteSite(ctx, prefix, opts, (at) => {
58
+ const { entity, changed, unchanged, run } = requestReview(at, prefix, people, {
59
+ commit: opts.commit,
60
+ remove: opts.remove,
61
+ });
62
+ const verb = opts.remove ? "No longer reviewing" : "Asked to review";
63
+ ctx.stdout.write(`${verb} #${entity.id}: ${changed.join(", ")}\n`);
64
+ // Naming who was already there matters most when only some of a list moved:
65
+ // the count alone would leave the caller counting names themselves.
66
+ for (const person of unchanged) {
67
+ ctx.stdout.write(`${ctx.colors.dim(opts.remove ? "not listed:" : "already listed:")} ${person}\n`);
68
+ }
69
+ if (opts.commit)
70
+ ctx.stdout.write(`${commitReport(run)}\n`);
55
71
  });
56
- const verb = opts.remove ? "No longer reviewing" : "Asked to review";
57
- ctx.stdout.write(`${verb} #${entity.id}: ${changed.join(", ")}\n`);
58
- // Naming who was already there matters most when only some of a list moved:
59
- // the count alone would leave the caller counting names themselves.
60
- for (const person of unchanged) {
61
- ctx.stdout.write(`${ctx.colors.dim(opts.remove ? "not listed:" : "already listed:")} ${person}\n`);
62
- }
63
- if (opts.commit)
64
- ctx.stdout.write(`${commitReport(run)}\n`);
65
72
  }
66
73
  export function cmdPrReview(ctx, prefix, opts) {
67
- const entity = findPrToWrite(ctx, prefix);
74
+ // Checked before anything is resolved, so a mistyped flag never costs a
75
+ // temporary checkout.
68
76
  const chosen = [opts.approve, opts.requestChanges, opts.comment].filter(Boolean).length;
69
77
  if (chosen > 1) {
70
78
  fail("choose one of --approve, --request-changes or --comment, not several");
71
79
  }
72
- const revision = bindReviewRevision(entity, opts.revision);
73
80
  if (opts.line && !opts.file)
74
81
  fail("--line needs --file");
75
- // This verb files reviews, so with no flag the verdict is the one that judges
76
- // nothing (spec 04 §4.3). The exception is an inline anchor: a note about one
77
- // line is discussion, and recording it as a review would say its author had
78
- // read the whole revision. `nav pr comment` remains the unbound comment.
79
- const verdict = opts.approve
80
- ? "approve"
81
- : opts.requestChanges
82
- ? "request-changes"
83
- : opts.file === undefined || opts.comment
84
- ? "comment"
85
- : undefined;
86
- const isReview = verdict !== undefined || opts.file !== undefined;
87
- const base = {
88
- author: currentAuthor(ctx),
89
- body: "",
90
- ...(verdict ? { verdict } : {}),
91
- ...(isReview ? { revision } : {}),
92
- ...(opts.file ? { file: opts.file } : {}),
93
- ...(opts.line ? { line: opts.line } : {}),
94
- };
95
- const composed = composeFile(ctx, {
96
- message: opts.message,
97
- bufferName: "NAVBOOK_REVIEW.md",
98
- noun: verdict ? "review" : "comment",
99
- render: (body) => newCommentFile({ ...base, body }),
100
- validate: (parsed) => validateComment(parsed, { onPr: true }),
82
+ withPrWriteSite(ctx, prefix, opts, (at, entity) => {
83
+ const revision = bindReviewRevision(entity, opts.revision);
84
+ // This verb files reviews, so with no flag the verdict is the one that judges
85
+ // nothing (spec 04 §4.3). The exception is an inline anchor: a note about one
86
+ // line is discussion, and recording it as a review would say its author had
87
+ // read the whole revision. `nav pr comment` remains the unbound comment.
88
+ const verdict = opts.approve
89
+ ? "approve"
90
+ : opts.requestChanges
91
+ ? "request-changes"
92
+ : opts.file === undefined || opts.comment
93
+ ? "comment"
94
+ : undefined;
95
+ const isReview = verdict !== undefined || opts.file !== undefined;
96
+ const base = {
97
+ author: currentAuthor(at),
98
+ body: "",
99
+ ...(verdict ? { verdict } : {}),
100
+ ...(isReview ? { revision } : {}),
101
+ ...(opts.file ? { file: opts.file } : {}),
102
+ ...(opts.line ? { line: opts.line } : {}),
103
+ };
104
+ const composed = composeFile(ctx, {
105
+ message: opts.message,
106
+ bufferName: "NAVBOOK_REVIEW.md",
107
+ noun: verdict ? "review" : "comment",
108
+ render: (body) => newCommentFile({ ...base, body }),
109
+ validate: (parsed) => validateComment(parsed, { onPr: true }),
110
+ });
111
+ const { id, path, run } = applyComment(at, entity, { content: composed.content, review: isReview }, { commit: opts.commit });
112
+ const label = verdict ? `Reviewed (${verdict})` : "Commented on";
113
+ ctx.stdout.write(`${label} #${entity.id} ${at.navDir}/${path} (#${id})\n`);
114
+ if (isReview)
115
+ ctx.stdout.write(`Bound to revision ${revision.slice(0, 12)}\n`);
116
+ if (opts.commit)
117
+ ctx.stdout.write(`${commitReport(run)}\n`);
118
+ // The policy that decides whether a verdict counts is the one in the tree
119
+ // the review was written into.
120
+ warnIfOwnVerdict(at, entity, verdict);
101
121
  });
102
- const { id, path, run } = applyComment(ctx, entity, { content: composed.content, review: isReview }, { commit: opts.commit });
103
- const label = verdict ? `Reviewed (${verdict})` : "Commented on";
104
- ctx.stdout.write(`${label} #${entity.id} ${ctx.navDir}/${path} (#${id})\n`);
105
- if (isReview)
106
- ctx.stdout.write(`Bound to revision ${revision.slice(0, 12)}\n`);
107
- if (opts.commit)
108
- ctx.stdout.write(`${commitReport(run)}\n`);
109
- warnIfOwnVerdict(ctx, entity, verdict);
110
122
  }
111
123
  /**
112
124
  * Warn an author that their own verdict will not be counted.
@@ -161,10 +173,13 @@ export function cmdPrList(ctx, terms, opts) {
161
173
  when: (entities) => entities.some((entity) => summaryOf(entity).reviewers.length > 0),
162
174
  },
163
175
  ];
176
+ // The listing's own columns first, then whatever plugins contributed: the
177
+ // caller's are added to these, never replaced by them.
178
+ const columns = [...extraColumns, ...(opts.extraColumns ?? [])];
164
179
  const query = parseListQuery(ctx, terms, "pr");
165
180
  if (!opts.allRefs) {
166
181
  const here = listEntities(ctx, "pr", query);
167
- reportList(ctx, "pr", here, { ...opts, extraColumns });
182
+ reportList(ctx, "pr", here, { ...opts, extraColumns: columns });
168
183
  if (here.length === 0)
169
184
  hintOtherRefs(ctx, opts);
170
185
  return;
@@ -173,7 +188,10 @@ export function cmdPrList(ctx, terms, opts) {
173
188
  if (opts.json) {
174
189
  if (matched.length === 0)
175
190
  return;
176
- ctx.stdout.write(`${toNdjson(matched.map((entry) => entityJson(ctx.navDir, entry.entity, { refs: entry.refs.map((ref) => ref.short) })))}\n`);
191
+ ctx.stdout.write(`${toNdjson(matched.map((entry) => entityJson(ctx.navDir, entry.entity, {
192
+ ...(opts.jsonExtra?.(entry.entity) ?? {}),
193
+ refs: entry.refs.map((ref) => ref.short),
194
+ })))}\n`);
177
195
  return;
178
196
  }
179
197
  if (matched.length === 0) {
@@ -183,7 +201,7 @@ export function cmdPrList(ctx, terms, opts) {
183
201
  reportList(ctx, "pr", listEntities(ctx, "pr", query, { entities: matched.map((e) => e.entity) }), {
184
202
  ...opts,
185
203
  extraColumns: [
186
- ...extraColumns,
204
+ ...columns,
187
205
  {
188
206
  header: "refs",
189
207
  value: (entity) => (matched.find((entry) => entry.entity.id === entity.id)?.refs ?? [])
@@ -208,7 +226,15 @@ export function cmdPrList(ctx, terms, opts) {
208
226
  function hintOtherRefs(ctx, opts) {
209
227
  if (opts.json)
210
228
  return;
211
- const count = countOpenPrsOnOtherRefs(ctx);
229
+ let count;
230
+ try {
231
+ count = countOpenPrsOnOtherRefs(ctx);
232
+ }
233
+ catch {
234
+ // The listing this follows has already been printed and is right; a branch
235
+ // git cannot read is `--all-refs`'s to report, not a reason to fail this.
236
+ return;
237
+ }
212
238
  if (count === 0)
213
239
  return;
214
240
  ctx.stderr.write(`${ctx.colors.dim(`${count} open pull ${count === 1 ? "request" : "requests"} on other branches; ` +
@@ -230,11 +256,26 @@ export function cmdPrMerge(ctx, prefix, opts) {
230
256
  }
231
257
  if (!prefix)
232
258
  fail("nav pr merge needs the ID of the pull request to merge");
233
- const plan = planPrMerge(ctx, prefix, { noFf: opts.noFf, syncSource });
259
+ const plan = planPrMerge(ctx, prefix, { method: readMethod(opts.method), syncSource });
234
260
  warnPolicyProblems(ctx, plan.review.reading);
261
+ warnMergePolicyProblems(ctx, plan.mergePolicy);
235
262
  confirmAgainstPolicy(ctx, plan.entity.id, plan.review, opts.yes === true);
236
263
  reportMerge(ctx, executePrMerge(ctx, plan));
237
264
  }
265
+ /**
266
+ * Read `--method`, or nothing when it was not given.
267
+ *
268
+ * Checked here rather than left to the plan, so a mistyped name costs nothing:
269
+ * the merge has not read a ref or touched the index yet, and the answer is the
270
+ * list of what it could have been.
271
+ */
272
+ function readMethod(value) {
273
+ if (value === undefined)
274
+ return undefined;
275
+ if (isMergeMethod(value))
276
+ return value;
277
+ fail(`'${value}' is not a merge method; expected one of ${MERGE_METHODS.join(", ")}`);
278
+ }
238
279
  /** What the pull request is short of, but only where a policy was declared. */
239
280
  function declaredShortfall(review) {
240
281
  return review.reading.declared ? describeShortfall(review.summary) : null;
@@ -265,28 +306,51 @@ function confirmAgainstPolicy(ctx, id, review, assumeYes) {
265
306
  }
266
307
  function reportMerge(ctx, result) {
267
308
  ctx.stdout.write(`Merged #${result.entity.id} ${ctx.navDir}/${result.dirPath}/\n`);
268
- if (result.mergeSha)
269
- ctx.stdout.write(`Merge commit ${result.mergeSha.slice(0, 12)}\n`);
270
- reportSourceSync(ctx, result.source, stringField(result.entity, "target"));
309
+ if (result.mergeSha) {
310
+ const what = result.method === "squash" ? "Squash commit" : "Merge commit";
311
+ ctx.stdout.write(`${what} ${result.mergeSha.slice(0, 12)}\n`);
312
+ }
313
+ reportSourceSync(ctx, result.source, result.method, stringField(result.entity, "target"));
271
314
  }
272
315
  /**
273
316
  * Say what became of the source branch. A move is one line; a branch that
274
317
  * could not be moved is a warning, because somebody now has to do by hand what
275
318
  * forgetting leaves wrong rather than stale; the rest costs nothing.
319
+ *
320
+ * The method is needed as well as the outcome, because a branch the target
321
+ * cannot reach means opposite things either side of a replay: after an
322
+ * ordinary merge it is a branch somebody still has to merge, and after a
323
+ * rebase it is the original of commits that are already on the target under
324
+ * new SHAs. Telling the second to "merge main into it" would undo the linear
325
+ * history they asked for.
276
326
  */
277
- function reportSourceSync(ctx, source, target) {
327
+ function reportSourceSync(ctx, source, method, target) {
278
328
  const warn = (text) => {
279
329
  ctx.stderr.write(`${ctx.colors.yellow("warning:")} ${text}\n`);
280
330
  };
331
+ const replayed = method === "rebase" || method === "rebase-no-ff";
281
332
  switch (source.outcome) {
282
333
  case "fast-forwarded":
283
334
  ctx.stdout.write(`Fast-forwarded ${source.ref} to ${target}\n`);
284
335
  return;
336
+ case "rebased":
337
+ ctx.stdout.write(`Rebased ${source.ref} onto ${target}\n`);
338
+ return;
339
+ case "squashed":
340
+ // Not a warning: this is the method doing what it says. What it is worth
341
+ // saying is that the branch is not contained in the target, because that
342
+ // is what somebody about to delete it would want to have known.
343
+ ctx.stdout.write(`${source.ref} was squashed; its own commits are not on ${target}, so it cannot be fast-forwarded\n`);
344
+ return;
285
345
  case "diverged":
286
- warn(`${source.ref} was not moved: it has commits ${target} does not; merge ${target} into it`);
346
+ warn(replayed
347
+ ? `${source.ref} was not moved: its commits were replayed onto ${target} under new SHAs; reset it with 'git reset --hard ${target}' there, or delete it`
348
+ : `${source.ref} was not moved: it has commits ${target} does not; merge ${target} into it`);
287
349
  return;
288
350
  case "checked-out":
289
- warn(`${source.ref} was not moved: it is checked out at ${source.worktree}; run 'git merge --ff-only ${target}' there`);
351
+ warn(replayed
352
+ ? `${source.ref} was not moved: it is checked out at ${source.worktree}; its commits were replayed onto ${target}, so reset it with 'git reset --hard ${target}' there`
353
+ : `${source.ref} was not moved: it is checked out at ${source.worktree}; run 'git merge --ff-only ${target}' there`);
290
354
  return;
291
355
  default:
292
356
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"pr.js","sourceRoot":"","sources":["../../src/commands/pr.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,uBAAuB,EACvB,aAAa,EAEb,UAAU,EACV,cAAc,EACd,aAAa,EACb,YAAY,EACZ,iBAAiB,EAGjB,qBAAqB,EAErB,cAAc,EACd,SAAS,EACT,MAAM,EACN,cAAc,EACd,WAAW,EACX,WAAW,EACX,aAAa,EAEb,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,aAAa,EAEb,SAAS,EACT,WAAW,EACX,QAAQ,EACR,QAAQ,EAER,eAAe,EACf,UAAU,GACX,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAEL,QAAQ,EAIR,UAAU,GACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAgBjF,MAAM,UAAU,SAAS,CAAC,GAAQ,EAAE,IAAmB;IACrD,MAAM,KAAK,GAAG,aAAa,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IAE7E,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE;QAChC,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,UAAU,EAAE,eAAe;QAC3B,IAAI,EAAE,cAAc;QACpB,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CACf,S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O;QACT;YACE,OAAO;IACX,CAAC;AACH,CAAC;AAED,iFAAiF;AAEjF;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CAAC,GAAQ,EAAE,MAAc,EAAE,IAAkB;IACrE,MAAM,YAAY,GAAG,qBAAqB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACxD,IAAI,YAAY,EAAE,CAAC;QACjB,GAAG,CAAC,MAAM,CAAC,KAAK,CACd,YAAY,YAAY,CAAC,EAAE,0BAA0B,YAAY,CAAC,GAAG,0BAA0B,CAChG,CAAC;IACJ,CAAC;IACD,QAAQ,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;AACpC,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * The CLI's context: a workspace context plus the terminal it reports to.
3
+ *
4
+ * Everything that is not presentation — repository paths, the clock, ID
5
+ * minting, identity — lives in `workspace/ctx.ts` and is shared with any other
6
+ * front end. This module adds only what a terminal program needs on top.
7
+ */
8
+ import { type CoreExtensions, type WsCtx } from "@navbook/core";
9
+ import { type Colors } from "./render/colors.ts";
10
+ export interface Ctx extends WsCtx {
11
+ colors: Colors;
12
+ stdout: NodeJS.WriteStream;
13
+ stderr: NodeJS.WriteStream;
14
+ }
15
+ export interface MakeContextOptions {
16
+ cwd?: string;
17
+ env?: NodeJS.ProcessEnv;
18
+ stdout?: NodeJS.WriteStream;
19
+ stderr?: NodeJS.WriteStream;
20
+ /** Skip repository discovery, for commands that work outside a repository. */
21
+ requireRepo?: boolean;
22
+ /** The Navbook directory, when the caller already knows it; see `makeWsCtx`. */
23
+ navDir?: string;
24
+ /**
25
+ * What the loaded plugins registered (spec 02 §2.12).
26
+ *
27
+ * Supplied only for a command whose declaration says it needs the format
28
+ * extensions, because loading them means importing plugin code and that is
29
+ * what the budget of spec 05 §5.2 cannot afford on every invocation.
30
+ */
31
+ ext?: CoreExtensions;
32
+ }
33
+ /**
34
+ * How the program asks for its context: built on first use, and memoised.
35
+ *
36
+ * `requireRepo: false` is for a command that works outside a repository; the
37
+ * default refuses to build one there, which is the error most commands want.
38
+ */
39
+ export type GetCtx = (opts?: {
40
+ requireRepo?: boolean;
41
+ }) => Ctx;
42
+ export declare function makeContext(opts?: MakeContextOptions): Ctx;
package/dist/context.js CHANGED
@@ -15,6 +15,8 @@ export function makeContext(opts = {}) {
15
15
  cwd: opts.cwd,
16
16
  env,
17
17
  ...(opts.requireRepo !== undefined ? { requireRepo: opts.requireRepo } : {}),
18
+ ...(opts.navDir !== undefined ? { navDir: opts.navDir } : {}),
19
+ ...(opts.ext !== undefined ? { ext: opts.ext } : {}),
18
20
  });
19
21
  return { ...ws, colors: makeColors(stdout, env), stdout, stderr };
20
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAc,MAAM,eAAe,CAAC;AACtD,OAAO,EAAe,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAiB7D,MAAM,UAAU,WAAW,CAAC,OAA2B,EAAE;IACvD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;IACpC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;IAC7C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;IAE7C,MAAM,EAAE,GAAG,SAAS,CAAC;QACnB,GAAG,EAAE,IAAI,CAAC,GAAG;QACb,GAAG;QACH,GAAG,CAAC,IAAI,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC7E,CAAC,CAAC;IAEH,OAAO,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AACpE,CAAC"}
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAuB,SAAS,EAAc,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAe,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAmC7D,MAAM,UAAU,WAAW,CAAC,OAA2B,EAAE;IACvD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;IACpC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;IAC7C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;IAE7C,MAAM,EAAE,GAAG,SAAS,CAAC;QACnB,GAAG,EAAE,IAAI,CAAC,GAAG;QACb,GAAG;QACH,GAAG,CAAC,IAAI,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5E,GAAG,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7D,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACrD,CAAC,CAAC;IAEH,OAAO,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AACpE,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * `$EDITOR` integration for the `--edit` flows.
3
+ *
4
+ * The editor is always opened on the real Navbook file, exactly as spec 04 §4.3
5
+ * describes, so nothing has to be parsed back out of a scratch buffer.
6
+ */
7
+ import type { Ctx } from "./context.ts";
8
+ /** Single-quote a path for a POSIX shell, escaping any embedded quotes. */
9
+ export declare function shellQuote(value: string): string;
10
+ /** The editor command to use, or null when none can be determined. */
11
+ export declare function editorCommand(env: NodeJS.ProcessEnv): string | null;
12
+ /** Open `absolutePath` in the user's editor, failing if it exits non-zero. */
13
+ export declare function openInEditor(ctx: Ctx, absolutePath: string): void;
14
+ /**
15
+ * Edit a Navbook file before it exists.
16
+ *
17
+ * The buffer is a real `.md` file (so editors highlight it) held next to
18
+ * `COMMIT_EDITMSG` in the git directory, and it is prefilled with the exact
19
+ * frontmatter the file will carry — the author can adjust the title, labels and
20
+ * body in one pass. Nothing is created in `.navbook/` until the text is valid,
21
+ * so an abort leaves no partial entity behind.
22
+ */
23
+ export declare function editBuffer(ctx: Ctx, name: string, initial: string): string;
package/dist/editor.js CHANGED
@@ -41,6 +41,10 @@ export function openInEditor(ctx, absolutePath) {
41
41
  });
42
42
  if (result.error)
43
43
  fail(`could not start editor '${editor}': ${result.error.message}`);
44
+ // Ctrl-C reaches the editor too, and a killed process has a signal, not a
45
+ // status: "status null" would say nothing about what happened.
46
+ if (result.signal)
47
+ fail(`editor '${editor}' was interrupted (${result.signal}); nothing was written`);
44
48
  if ((result.status ?? 1) !== 0)
45
49
  fail(`editor '${editor}' exited with status ${result.status}`);
46
50
  }
@@ -1 +1 @@
1
- {"version":3,"file":"editor.js","sourceRoot":"","sources":["../src/editor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,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aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACrC,IAAI,CAAC;QACH,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACxB,OAAO,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACpC,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAChC,CAAC;AACH,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Exit codes — spec 04 §4.2: 0 success, 1 operational error, 2 format violation.
3
+ */
4
+ export type ExitCode = 0 | 1 | 2;
5
+ export declare class NavError extends Error {
6
+ readonly exitCode: ExitCode;
7
+ /** Extra lines printed under the message, e.g. candidate IDs. */
8
+ readonly details: string[];
9
+ constructor(message: string, opts?: {
10
+ exitCode?: ExitCode;
11
+ details?: string[];
12
+ });
13
+ }
14
+ /** An operational error: not found, ambiguous, malformed input (exit 1). */
15
+ export declare function fail(message: string, details?: string[]): never;
16
+ /** A format violation detected by `doctor` (exit 2). */
17
+ export declare function failFormat(message: string, details?: string[]): never;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Shell completions.
3
+ *
4
+ * The scripts stay deliberately thin: anything that needs to know about the
5
+ * repository calls back into `nav __complete`, so completion behavior lives in
6
+ * one implementation rather than three shell dialects.
7
+ */
8
+ export declare const SHELLS: readonly ["bash", "zsh", "fish"];
9
+ export type Shell = (typeof SHELLS)[number];
10
+ export declare function isShell(value: string): value is Shell;
11
+ /** Guess the user's shell from `$SHELL`, defaulting to bash. */
12
+ export declare function detectShell(env: NodeJS.ProcessEnv): Shell;
13
+ /** Where a shell looks for per-user completion scripts. */
14
+ export declare function completionPath(shell: Shell, env: NodeJS.ProcessEnv): string;
15
+ /** Extra advice printed after installing, where a shell needs configuration. */
16
+ export declare function completionNote(shell: Shell, path: string): string | null;
17
+ export declare function completionScript(shell: Shell): string;
18
+ export declare function installCompletions(shell: Shell, env: NodeJS.ProcessEnv): string;
19
+ export declare function uninstallCompletions(shell: Shell, env: NodeJS.ProcessEnv): string | null;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * The `pre-commit` hook — spec 04 §4.5.
3
+ *
4
+ * The hook is a thin shell script that calls the binary, so `--no-verify` and
5
+ * manual hook removal behave exactly as users expect. It is written as a marked
6
+ * block appended to any existing hook, and `nav uninstall --hooks` removes
7
+ * precisely that block and nothing else.
8
+ */
9
+ export declare const MARKER_BEGIN = "# >>> navbook >>>";
10
+ export declare const MARKER_END = "# <<< navbook <<<";
11
+ export declare const HOOK_NAME = "pre-commit";
12
+ export declare function hookPath(repoRoot: string): string;
13
+ export declare function isInstalled(repoRoot: string): boolean;
14
+ /**
15
+ * Whether the hook has the block, and whether it is this `nav`'s.
16
+ *
17
+ * `outdated` is a block an older `nav` wrote: the markers are there but what
18
+ * is between them is not what this one would write — the block before the
19
+ * `set -e` fix, say. Seeing only the marker would leave every existing
20
+ * install with the old block for good.
21
+ */
22
+ export declare function hookState(repoRoot: string): "absent" | "current" | "outdated";
23
+ /**
24
+ * Write the marked block: appended, creating the hook file if there is none,
25
+ * or put in place of an older block, leaving everything around it alone.
26
+ */
27
+ export declare function installHook(repoRoot: string): void;
28
+ /**
29
+ * Remove exactly the marked block. A hook that contained nothing else is
30
+ * deleted; a hook the user also wrote by hand keeps everything they wrote.
31
+ */
32
+ export declare function uninstallHook(repoRoot: string): void;
@@ -17,9 +17,15 @@ const BODY = `${MARKER_BEGIN}
17
17
  # Validate staged Navbook files. Only a format violation (exit 2) blocks the
18
18
  # commit; warnings never do, and a clone without nav installed is unaffected.
19
19
  # Commit with --no-verify, or delete this block, to skip the check.
20
+ #
21
+ # The status is captured rather than tested on the next line: this block is
22
+ # appended to whatever hook was already here, and under 'set -e' a bare
23
+ # 'nav doctor --staged' would end the hook on exit 1 (an operational error,
24
+ # not a format violation) before the test below ever ran.
20
25
  if command -v nav >/dev/null 2>&1; then
21
- nav doctor --staged
22
- if [ $? -eq 2 ]; then
26
+ navbook_status=0
27
+ nav doctor --staged || navbook_status=$?
28
+ if [ "$navbook_status" -eq 2 ]; then
23
29
  exit 1
24
30
  fi
25
31
  fi
@@ -31,13 +37,51 @@ export function isInstalled(repoRoot) {
31
37
  const path = hookPath(repoRoot);
32
38
  return existsSync(path) && readFileSync(path, "utf8").includes(MARKER_BEGIN);
33
39
  }
34
- /** Append the marked block, creating the hook file if there is none. */
40
+ /**
41
+ * Whether the hook has the block, and whether it is this `nav`'s.
42
+ *
43
+ * `outdated` is a block an older `nav` wrote: the markers are there but what
44
+ * is between them is not what this one would write — the block before the
45
+ * `set -e` fix, say. Seeing only the marker would leave every existing
46
+ * install with the old block for good.
47
+ */
48
+ export function hookState(repoRoot) {
49
+ const path = hookPath(repoRoot);
50
+ if (!existsSync(path))
51
+ return "absent";
52
+ const block = findBlock(readFileSync(path, "utf8"));
53
+ if (block === null)
54
+ return "absent";
55
+ return block.text === BODY ? "current" : "outdated";
56
+ }
57
+ /** The marked block's text and where it sits, or null when there is none. */
58
+ function findBlock(content) {
59
+ const start = content.indexOf(MARKER_BEGIN);
60
+ if (start === -1)
61
+ return null;
62
+ const close = content.indexOf(MARKER_END, start);
63
+ // An opening marker with no closing one is a block somebody cut short by
64
+ // hand; it runs to the end of the file, which is what uninstall assumes too.
65
+ const end = close === -1 ? content.length : close + MARKER_END.length;
66
+ return { start, end, text: content.slice(start, end) };
67
+ }
68
+ /**
69
+ * Write the marked block: appended, creating the hook file if there is none,
70
+ * or put in place of an older block, leaving everything around it alone.
71
+ */
35
72
  export function installHook(repoRoot) {
36
73
  const path = hookPath(repoRoot);
37
74
  mkdirSync(dirname(path), { recursive: true });
38
75
  const existing = existsSync(path) ? readFileSync(path, "utf8") : "";
39
- if (existing.includes(MARKER_BEGIN))
76
+ const block = findBlock(existing);
77
+ if (block !== null) {
78
+ if (block.text === BODY)
79
+ return;
80
+ const replaced = `${existing.slice(0, block.start)}${BODY}${existing.slice(block.end)}`;
81
+ writeFileSync(path, replaced.endsWith("\n") ? replaced : `${replaced}\n`, "utf8");
82
+ chmodSync(path, statSync(path).mode | 0o111);
40
83
  return;
84
+ }
41
85
  const content = existing.trim() === ""
42
86
  ? `${SHEBANG}\n${BODY}\n`
43
87
  : `${existing.replace(/\n*$/, "\n")}\n${BODY}\n`;