@reviewflow/sdk 6.24.0 → 6.25.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.
@@ -403,7 +403,7 @@ const groupDiffPaths = (isPackage, paths) => {
403
403
  if (group === void 0) groups.set(name, [path]);
404
404
  else group.push(path);
405
405
  }
406
- return [...groups].toSorted(([left], [right]) => Number(left !== "") - Number(right !== "")).map(([name, groupPaths]) => ({ name, paths: groupPaths }));
406
+ return [...groups].toSorted(([left], [right]) => Number(left === "") - Number(right === "")).map(([name, groupPaths]) => ({ name, paths: groupPaths }));
407
407
  };
408
408
 
409
409
  const cEscapes = {
@@ -782,7 +782,7 @@ const orderPackages = (names, dependsOn) => {
782
782
  const isDependedOnByRemaining = (name) => [...remaining].some(
783
783
  (other) => other !== name && dependencies.get(other).has(name)
784
784
  );
785
- const ordered = names.includes("") ? [""] : [];
785
+ const ordered = [];
786
786
  while (remaining.size > 0) {
787
787
  const sorted = [...remaining].toSorted(
788
788
  (left, right) => left.localeCompare(right)
@@ -791,6 +791,7 @@ const orderPackages = (names, dependsOn) => {
791
791
  ordered.push(next);
792
792
  remaining.delete(next);
793
793
  }
794
+ if (names.includes("")) ordered.push("");
794
795
  return ordered;
795
796
  };
796
797
  const orderForReading = ({
@@ -98,6 +98,7 @@ const subjectsOf = (path) => {
98
98
  };
99
99
 
100
100
  const diffThemes = [
101
+ "reviewflow",
101
102
  "github",
102
103
  "github-high-contrast",
103
104
  "pierre",
@@ -116,7 +117,12 @@ const diffThemes = [
116
117
  "min"
117
118
  ];
118
119
  const isDiffTheme = (value) => diffThemes.includes(value);
120
+ const defaultDiffTheme = "reviewflow";
119
121
  const families = {
122
+ reviewflow: {
123
+ label: "Reviewflow",
124
+ themes: { light: "reviewflow-light", dark: "reviewflow-dark" }
125
+ },
120
126
  github: {
121
127
  label: "GitHub",
122
128
  themes: { light: "github-light-default", dark: "github-dark-default" }
@@ -181,6 +187,13 @@ const diffThemeOptions = diffThemes.map((theme) => ({
181
187
  value: theme,
182
188
  label: families[theme].label
183
189
  }));
190
+ const isDiffFont = (value) => value === "alouette" || value === "pierre" || value === "custom";
191
+ const defaultDiffFont = "alouette";
192
+ const diffFontOptions = [
193
+ { value: "alouette", label: "Alouette (Chivo Mono)" },
194
+ { value: "pierre", label: "Pierre (system mono)" },
195
+ { value: "custom", label: "Custom" }
196
+ ];
184
197
 
185
198
  const isDiffWhitespace = (value) => value === "hide" || value === "show";
186
199
 
@@ -3475,6 +3488,8 @@ const createReviewflowFollower = ({
3475
3488
  };
3476
3489
  };
3477
3490
 
3491
+ const defaultRepoPath = "~/dev/";
3492
+
3478
3493
  const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
3479
3494
  const insertCheckoutEntry = (source, ownerRepo) => {
3480
3495
  let parsed;
@@ -3506,5 +3521,5 @@ const insertCheckoutEntry = (source, ownerRepo) => {
3506
3521
  return { source: text, cursor: value };
3507
3522
  };
3508
3523
 
3509
- export { accountOfOwnerRepo, applyPullRequestEdit, applyStreamEvent, applySuggestionsToText, assembleBoard, boardReadDelayMs, buildPrQuery, changedPullRequestParts, checkOutcomes, checksFromReviewflow, coAuthorTrailers, commitSuggestions, createGitHubTransport, createReviewflowClient, createReviewflowFollower, diffLines, diffPaths, diffThemeNames, diffThemeOptions, diffThemes, editPullRequest, fail, fetchCompareDiff, fetchPullRequestCandidates, fetchPullRequestHead, fetchPullRequestPart, fetchPullRequestRevisions, formatPrChanges, formatRelativeDate, insertCheckoutEntry, interpretGraphql, isAttachablePath, isDiffTheme, isDiffWhitespace, isPullRequestOnBoard, isPullRequestPart, isPullRequestReactionContent, isReviewflowFailure, lingerMs, maxExtraPagesPerBucket, maxFailedCheckNames, maxLookupTargets, maxRetryMs, parsePrQueryResponse, parsePullRequestCandidates, parsePullRequestChecks, parsePullRequestCommits, parsePullRequestDetail, parsePullRequestEdit, parsePullRequestFiles, parsePullRequestRevisions, parsePullRequestTimeline, parseSuggestions, partFingerprint, planSuggestions, pluralOf, prFields, prHasConflicts, prNumberOf, prStatus, prStatusLabels, prStatuses, prUrl, pullRequestCandidatesQuery, pullRequestChecksQuery, pullRequestCommitsQuery, pullRequestDetailQuery, pullRequestEditMovesBoard, pullRequestFilesQuery, pullRequestHeadQuery, pullRequestParts, pullRequestPartsStaleAfter, pullRequestReactionContents, pullRequestRevisionsQuery, pullRequestTimelineQuery, readAccountBoards, readPrDetail, readReviewflowStream, reconnectDelayMs, responseFailure, restErrorMessage, reviewflowErrorCode, reviewflowPrChangesRequested, reviewflowPrFailure, reviewflowPrFlowDate, reviewflowPrOwners, reviewflowPrProgress, reviewflowPrStatus, reviewflowReviewDecisions, splitOwnerRepo, streamClosedWithinDays, streamIdleTimeoutMs, subjectsOf, suggestionCommitRefusal, suggestionOriginalLines, suggestionRangesOverlap, toBoardPr, toFetchedPr, withAccountBoard, withFileViewed };
3524
+ export { accountOfOwnerRepo, applyPullRequestEdit, applyStreamEvent, applySuggestionsToText, assembleBoard, boardReadDelayMs, buildPrQuery, changedPullRequestParts, checkOutcomes, checksFromReviewflow, coAuthorTrailers, commitSuggestions, createGitHubTransport, createReviewflowClient, createReviewflowFollower, defaultDiffFont, defaultDiffTheme, defaultRepoPath, diffFontOptions, diffLines, diffPaths, diffThemeNames, diffThemeOptions, diffThemes, editPullRequest, fail, fetchCompareDiff, fetchPullRequestCandidates, fetchPullRequestHead, fetchPullRequestPart, fetchPullRequestRevisions, formatPrChanges, formatRelativeDate, insertCheckoutEntry, interpretGraphql, isAttachablePath, isDiffFont, isDiffTheme, isDiffWhitespace, isPullRequestOnBoard, isPullRequestPart, isPullRequestReactionContent, isReviewflowFailure, lingerMs, maxExtraPagesPerBucket, maxFailedCheckNames, maxLookupTargets, maxRetryMs, parsePrQueryResponse, parsePullRequestCandidates, parsePullRequestChecks, parsePullRequestCommits, parsePullRequestDetail, parsePullRequestEdit, parsePullRequestFiles, parsePullRequestRevisions, parsePullRequestTimeline, parseSuggestions, partFingerprint, planSuggestions, pluralOf, prFields, prHasConflicts, prNumberOf, prStatus, prStatusLabels, prStatuses, prUrl, pullRequestCandidatesQuery, pullRequestChecksQuery, pullRequestCommitsQuery, pullRequestDetailQuery, pullRequestEditMovesBoard, pullRequestFilesQuery, pullRequestHeadQuery, pullRequestParts, pullRequestPartsStaleAfter, pullRequestReactionContents, pullRequestRevisionsQuery, pullRequestTimelineQuery, readAccountBoards, readPrDetail, readReviewflowStream, reconnectDelayMs, responseFailure, restErrorMessage, reviewflowErrorCode, reviewflowPrChangesRequested, reviewflowPrFailure, reviewflowPrFlowDate, reviewflowPrOwners, reviewflowPrProgress, reviewflowPrStatus, reviewflowReviewDecisions, splitOwnerRepo, streamClosedWithinDays, streamIdleTimeoutMs, subjectsOf, suggestionCommitRefusal, suggestionOriginalLines, suggestionRangesOverlap, toBoardPr, toFetchedPr, withAccountBoard, withFileViewed };
3510
3525
  //# sourceMappingURL=index-browser.es.js.map
@@ -98,6 +98,7 @@ const subjectsOf = (path) => {
98
98
  };
99
99
 
100
100
  const diffThemes = [
101
+ "reviewflow",
101
102
  "github",
102
103
  "github-high-contrast",
103
104
  "pierre",
@@ -116,7 +117,12 @@ const diffThemes = [
116
117
  "min"
117
118
  ];
118
119
  const isDiffTheme = (value) => diffThemes.includes(value);
120
+ const defaultDiffTheme = "reviewflow";
119
121
  const families = {
122
+ reviewflow: {
123
+ label: "Reviewflow",
124
+ themes: { light: "reviewflow-light", dark: "reviewflow-dark" }
125
+ },
120
126
  github: {
121
127
  label: "GitHub",
122
128
  themes: { light: "github-light-default", dark: "github-dark-default" }
@@ -181,6 +187,13 @@ const diffThemeOptions = diffThemes.map((theme) => ({
181
187
  value: theme,
182
188
  label: families[theme].label
183
189
  }));
190
+ const isDiffFont = (value) => value === "alouette" || value === "pierre" || value === "custom";
191
+ const defaultDiffFont = "alouette";
192
+ const diffFontOptions = [
193
+ { value: "alouette", label: "Alouette (Chivo Mono)" },
194
+ { value: "pierre", label: "Pierre (system mono)" },
195
+ { value: "custom", label: "Custom" }
196
+ ];
184
197
 
185
198
  const isDiffWhitespace = (value) => value === "hide" || value === "show";
186
199
 
@@ -3475,6 +3488,8 @@ const createReviewflowFollower = ({
3475
3488
  };
3476
3489
  };
3477
3490
 
3491
+ const defaultRepoPath = "~/dev/";
3492
+
3478
3493
  const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
3479
3494
  const insertCheckoutEntry = (source, ownerRepo) => {
3480
3495
  let parsed;
@@ -3506,5 +3521,5 @@ const insertCheckoutEntry = (source, ownerRepo) => {
3506
3521
  return { source: text, cursor: value };
3507
3522
  };
3508
3523
 
3509
- export { accountOfOwnerRepo, applyPullRequestEdit, applyStreamEvent, applySuggestionsToText, assembleBoard, boardReadDelayMs, buildPrQuery, changedPullRequestParts, checkOutcomes, checksFromReviewflow, coAuthorTrailers, commitSuggestions, createGitHubTransport, createReviewflowClient, createReviewflowFollower, diffLines, diffPaths, diffThemeNames, diffThemeOptions, diffThemes, editPullRequest, fail, fetchCompareDiff, fetchPullRequestCandidates, fetchPullRequestHead, fetchPullRequestPart, fetchPullRequestRevisions, formatPrChanges, formatRelativeDate, insertCheckoutEntry, interpretGraphql, isAttachablePath, isDiffTheme, isDiffWhitespace, isPullRequestOnBoard, isPullRequestPart, isPullRequestReactionContent, isReviewflowFailure, lingerMs, maxExtraPagesPerBucket, maxFailedCheckNames, maxLookupTargets, maxRetryMs, parsePrQueryResponse, parsePullRequestCandidates, parsePullRequestChecks, parsePullRequestCommits, parsePullRequestDetail, parsePullRequestEdit, parsePullRequestFiles, parsePullRequestRevisions, parsePullRequestTimeline, parseSuggestions, partFingerprint, planSuggestions, pluralOf, prFields, prHasConflicts, prNumberOf, prStatus, prStatusLabels, prStatuses, prUrl, pullRequestCandidatesQuery, pullRequestChecksQuery, pullRequestCommitsQuery, pullRequestDetailQuery, pullRequestEditMovesBoard, pullRequestFilesQuery, pullRequestHeadQuery, pullRequestParts, pullRequestPartsStaleAfter, pullRequestReactionContents, pullRequestRevisionsQuery, pullRequestTimelineQuery, readAccountBoards, readPrDetail, readReviewflowStream, reconnectDelayMs, responseFailure, restErrorMessage, reviewflowErrorCode, reviewflowPrChangesRequested, reviewflowPrFailure, reviewflowPrFlowDate, reviewflowPrOwners, reviewflowPrProgress, reviewflowPrStatus, reviewflowReviewDecisions, splitOwnerRepo, streamClosedWithinDays, streamIdleTimeoutMs, subjectsOf, suggestionCommitRefusal, suggestionOriginalLines, suggestionRangesOverlap, toBoardPr, toFetchedPr, withAccountBoard, withFileViewed };
3524
+ export { accountOfOwnerRepo, applyPullRequestEdit, applyStreamEvent, applySuggestionsToText, assembleBoard, boardReadDelayMs, buildPrQuery, changedPullRequestParts, checkOutcomes, checksFromReviewflow, coAuthorTrailers, commitSuggestions, createGitHubTransport, createReviewflowClient, createReviewflowFollower, defaultDiffFont, defaultDiffTheme, defaultRepoPath, diffFontOptions, diffLines, diffPaths, diffThemeNames, diffThemeOptions, diffThemes, editPullRequest, fail, fetchCompareDiff, fetchPullRequestCandidates, fetchPullRequestHead, fetchPullRequestPart, fetchPullRequestRevisions, formatPrChanges, formatRelativeDate, insertCheckoutEntry, interpretGraphql, isAttachablePath, isDiffFont, isDiffTheme, isDiffWhitespace, isPullRequestOnBoard, isPullRequestPart, isPullRequestReactionContent, isReviewflowFailure, lingerMs, maxExtraPagesPerBucket, maxFailedCheckNames, maxLookupTargets, maxRetryMs, parsePrQueryResponse, parsePullRequestCandidates, parsePullRequestChecks, parsePullRequestCommits, parsePullRequestDetail, parsePullRequestEdit, parsePullRequestFiles, parsePullRequestRevisions, parsePullRequestTimeline, parseSuggestions, partFingerprint, planSuggestions, pluralOf, prFields, prHasConflicts, prNumberOf, prStatus, prStatusLabels, prStatuses, prUrl, pullRequestCandidatesQuery, pullRequestChecksQuery, pullRequestCommitsQuery, pullRequestDetailQuery, pullRequestEditMovesBoard, pullRequestFilesQuery, pullRequestHeadQuery, pullRequestParts, pullRequestPartsStaleAfter, pullRequestReactionContents, pullRequestRevisionsQuery, pullRequestTimelineQuery, readAccountBoards, readPrDetail, readReviewflowStream, reconnectDelayMs, responseFailure, restErrorMessage, reviewflowErrorCode, reviewflowPrChangesRequested, reviewflowPrFailure, reviewflowPrFlowDate, reviewflowPrOwners, reviewflowPrProgress, reviewflowPrStatus, reviewflowReviewDecisions, splitOwnerRepo, streamClosedWithinDays, streamIdleTimeoutMs, subjectsOf, suggestionCommitRefusal, suggestionOriginalLines, suggestionRangesOverlap, toBoardPr, toFetchedPr, withAccountBoard, withFileViewed };
3510
3525
  //# sourceMappingURL=index-node.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reviewflow/sdk",
3
- "version": "6.24.0",
3
+ "version": "6.25.0",
4
4
  "description": "pull request model shared by the reviewflow app server and its ui: diff and api types, pure utils, the GitHub layer behind an injected transport, and (node only) reading a diff from a local checkout (@reviewflow/sdk/git) and editing a text file in place (@reviewflow/sdk/files)",
5
5
  "keywords": [
6
6
  "code-review",
@@ -0,0 +1,2 @@
1
+ /** Where the app searches checkouts when `config.json` sets no `defaultRepoPath`. */
2
+ export const defaultRepoPath = "~/dev/";
@@ -381,9 +381,9 @@ const transitiveDependencies = (
381
381
  };
382
382
 
383
383
  /**
384
- * The root first, as `groupDiffPaths` has it; then a package before every
385
- * package it depends on, directly or through a package the change does not
386
- * touch. Alphabetical between two unrelated packages, and to break a cycle.
384
+ * A package before every package it depends on, directly or through a
385
+ * package the change does not touch. Alphabetical between two unrelated
386
+ * packages, and to break a cycle. The root last, as `groupDiffPaths` has it.
387
387
  */
388
388
  export const orderPackages = (
389
389
  names: readonly string[],
@@ -401,7 +401,7 @@ export const orderPackages = (
401
401
  (other) => other !== name && dependencies.get(other)!.has(name),
402
402
  );
403
403
 
404
- const ordered = names.includes("") ? [""] : [];
404
+ const ordered: string[] = [];
405
405
  while (remaining.size > 0) {
406
406
  const sorted = [...remaining].toSorted((left, right) =>
407
407
  left.localeCompare(right),
@@ -411,6 +411,7 @@ export const orderPackages = (
411
411
  ordered.push(next);
412
412
  remaining.delete(next);
413
413
  }
414
+ if (names.includes("")) ordered.push("");
414
415
  return ordered;
415
416
  };
416
417
 
@@ -5,6 +5,7 @@
5
5
  * same list the ui renders.
6
6
  */
7
7
  export const diffThemes = [
8
+ "reviewflow",
8
9
  "github",
9
10
  "github-high-contrast",
10
11
  "pierre",
@@ -28,13 +29,22 @@ export type DiffTheme = (typeof diffThemes)[number];
28
29
  export const isDiffTheme = (value: unknown): value is DiffTheme =>
29
30
  (diffThemes as readonly unknown[]).includes(value);
30
31
 
32
+ export const defaultDiffTheme: DiffTheme = "reviewflow";
33
+
31
34
  interface DiffThemeFamily {
32
35
  label: string;
33
- /** shiki theme names, the pierre ones resolved by `@pierre/diffs` itself */
36
+ /**
37
+ * shiki theme names, the pierre ones resolved by `@pierre/diffs` itself, the
38
+ * reviewflow ones registered by `@reviewflow/ui`
39
+ */
34
40
  themes: { light: string; dark: string };
35
41
  }
36
42
 
37
43
  const families: Record<DiffTheme, DiffThemeFamily> = {
44
+ reviewflow: {
45
+ label: "Reviewflow",
46
+ themes: { light: "reviewflow-light", dark: "reviewflow-dark" },
47
+ },
38
48
  github: {
39
49
  label: "GitHub",
40
50
  themes: { light: "github-light-default", dark: "github-dark-default" },
@@ -103,3 +113,21 @@ export const diffThemeOptions = diffThemes.map((theme) => ({
103
113
  value: theme,
104
114
  label: families[theme].label,
105
115
  }));
116
+
117
+ /**
118
+ * The diff's code font: `alouette` is the design system's mono (Chivo Mono),
119
+ * `pierre` the system mono stack `@pierre/diffs` ships with, `custom` a font
120
+ * the user names (a CSS `font-family`, stored apart).
121
+ */
122
+ export type DiffFont = "alouette" | "custom" | "pierre";
123
+
124
+ export const isDiffFont = (value: unknown): value is DiffFont =>
125
+ value === "alouette" || value === "pierre" || value === "custom";
126
+
127
+ export const defaultDiffFont: DiffFont = "alouette";
128
+
129
+ export const diffFontOptions: { value: DiffFont; label: string }[] = [
130
+ { value: "alouette", label: "Alouette (Chivo Mono)" },
131
+ { value: "pierre", label: "Pierre (system mono)" },
132
+ { value: "custom", label: "Custom" },
133
+ ];
@@ -126,9 +126,9 @@ export const groupDiffPaths = (
126
126
  if (group === undefined) groups.set(name, [path]);
127
127
  else group.push(path);
128
128
  }
129
- // The root first: its files (a lockfile, the root manifest, a README) are
130
- // what the rest of the change is read against.
129
+ // The root last: its files (a lockfile, the root manifest, a README) follow
130
+ // from the packages' changes rather than explain them.
131
131
  return [...groups]
132
- .toSorted(([left], [right]) => Number(left !== "") - Number(right !== ""))
132
+ .toSorted(([left], [right]) => Number(left === "") - Number(right === ""))
133
133
  .map(([name, groupPaths]) => ({ name, paths: groupPaths }));
134
134
  };
package/src/index.ts CHANGED
@@ -35,5 +35,6 @@ export * from "./reviewflow/board.ts";
35
35
  export * from "./reviewflow/boardFacts.ts";
36
36
  export * from "./reviewflow/follow.ts";
37
37
  export type * from "./reviewflow/status.ts";
38
+ export { defaultRepoPath } from "./config/defaultRepoPath.ts";
38
39
  export { insertCheckoutEntry } from "./config/insertCheckoutEntry.ts";
39
40
  export type { InsertedCheckoutEntry } from "./config/insertCheckoutEntry.ts";