@north-light/cli 0.3.707 → 0.3.709
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/dist/api/client.d.ts +1 -2
- package/dist/api/client.js +3 -3
- package/dist/api/contract.d.ts +1 -1
- package/dist/api/contract.js +1 -1
- package/dist/api/dto/crons.d.ts +3 -0
- package/dist/api/dto/human.d.ts +9 -6
- package/dist/api/dto/inbox.d.ts +2 -0
- package/dist/api/dto/review-comments.d.ts +12 -35
- package/dist/api/dto/reviews.d.ts +3 -10
- package/dist/api/routes.d.ts +0 -1
- package/dist/api/routes.js +1 -1
- package/dist/builtin-memory/05-kinds/review/companion/00-base.md +2 -2
- package/dist/builtin-memory/crouter-sdk/release-notes.md +6 -0
- package/dist/clients/attach/chrome/canvas-panels.d.ts +1 -1
- package/dist/clients/attach/chrome/canvas-panels.js +1 -1
- package/dist/clients/attach/chrome/inbox-strip.js +1 -1
- package/dist/clients/attach/chrome/roster.js +6 -6
- package/dist/clients/attach/chrome/status-line.d.ts +1 -1
- package/dist/clients/attach/chrome/status-line.js +1 -1
- package/dist/clients/attach/chrome/ticket-panel.js +1 -1
- package/dist/clients/attach/input/capabilities.js +1 -1
- package/dist/clients/attach/input/controller.d.ts +4 -1
- package/dist/clients/attach/input/controller.js +3 -3
- package/dist/clients/attach/input/overlay-owner.d.ts +0 -1
- package/dist/clients/attach/input/overlay-owner.js +1 -1
- package/dist/clients/attach/overlays/graph.d.ts +3 -2
- package/dist/clients/attach/overlays/graph.js +1 -1
- package/dist/clients/attach/render/chat-view.d.ts +2 -0
- package/dist/clients/attach/render/chat-view.js +1 -1
- package/dist/clients/attach/render/doc-links.d.ts +1 -1
- package/dist/clients/attach/session/chrome-refresh.js +1 -1
- package/dist/clients/attach/session/connection.d.ts +10 -9
- package/dist/clients/attach/session/connection.js +1 -1
- package/dist/clients/attach/session/context.d.ts +1 -1
- package/dist/clients/attach/session/document-links.d.ts +1 -1
- package/dist/clients/attach/session/document-links.js +1 -1
- package/dist/clients/attach/session/identity.d.ts +2 -0
- package/dist/clients/attach/session/identity.js +1 -1
- package/dist/clients/attach/session/input-wiring.d.ts +2 -0
- package/dist/clients/attach/session/input-wiring.js +1 -1
- package/dist/clients/attach/session/keys.d.ts +2 -2
- package/dist/clients/attach/session/keys.js +1 -1
- package/dist/clients/attach/session/pane-tag.d.ts +3 -1
- package/dist/clients/attach/session/pane-tag.js +1 -1
- package/dist/clients/attach/session/reconnect.js +1 -1
- package/dist/clients/attach/session/surface-host.d.ts +0 -5
- package/dist/clients/attach/session/surface-host.js +1 -1
- package/dist/clients/attach/session/teardown.d.ts +2 -2
- package/dist/clients/attach/session/teardown.js +9 -7
- package/dist/clients/attach/viewer.d.ts +7 -5
- package/dist/clients/attach/viewer.js +571 -584
- package/dist/clients/editor-roundtrip.js +3 -0
- package/dist/clients/inbox/controller.d.ts +1 -6
- package/dist/clients/inbox/controller.js +1 -1
- package/dist/clients/inbox/dto-adapt.js +1 -1
- package/dist/clients/inbox/tui/page-body.js +1 -1
- package/dist/clients/inbox/tui/render.js +2 -2
- package/dist/clients/open-browser.d.ts +2 -0
- package/dist/clients/open-browser.js +1 -0
- package/dist/clients/surfaces/host.d.ts +0 -6
- package/dist/commands/human/review.js +1 -1
- package/dist/commands/node/wait.js +2 -6
- package/dist/commands/sys/context/admin/shell.js +1 -1
- package/dist/core/broker-client/client.d.ts +6 -3
- package/dist/core/broker-client/client.js +1 -1
- package/dist/core/canvas/crons.d.ts +11 -1
- package/dist/core/canvas/crons.js +14 -14
- package/dist/core/canvas/executions.js +1 -1
- package/dist/core/canvas/schema-pg/025-review-anchors.sql +19 -0
- package/dist/core/canvas/schema-pg/026-cron-deadline-body.sql +9 -0
- package/dist/core/canvas/schema-pg/027-cron-fires.sql +4 -0
- package/dist/core/canvas/schema-version.d.ts +1 -1
- package/dist/core/canvas/schema-version.js +1 -1
- package/dist/core/command.js +5 -5
- package/dist/core/feed/messages.d.ts +5 -0
- package/dist/core/feed/messages.js +5 -5
- package/dist/core/human/page-markdown.js +10 -12
- package/dist/core/human/tickets.js +1 -1
- package/dist/core/human/types.d.ts +4 -6
- package/dist/core/keybindings/attach-control.d.ts +0 -3
- package/dist/core/keybindings/attach-control.js +1 -1
- package/dist/core/keybindings/catalog.d.ts +1 -1
- package/dist/core/keybindings/catalog.js +1 -1
- package/dist/core/review/anchors.d.ts +28 -0
- package/dist/core/review/anchors.js +6 -0
- package/dist/core/review/comments.d.ts +2 -2
- package/dist/core/review/comments.js +7 -8
- package/dist/core/review/companion.d.ts +2 -1
- package/dist/core/review/companion.js +1 -1
- package/dist/core/review/document.d.ts +4 -17
- package/dist/core/review/document.js +1 -2
- package/dist/core/review/fork.js +2 -4
- package/dist/core/review/project.d.ts +1 -1
- package/dist/core/review/project.js +2 -2
- package/dist/core/review/realize.js +1 -1
- package/dist/core/review/stage.d.ts +2 -9
- package/dist/core/review/stage.js +1 -1
- package/dist/core/review/types.d.ts +16 -12
- package/dist/core/review/types.js +1 -1
- package/dist/core/runtime/bearings.js +4 -4
- package/dist/core/runtime/boot-root.js +4 -4
- package/dist/core/runtime/broker-cli.js +3 -3
- package/dist/core/runtime/broker-extension-render.js +1 -1
- package/dist/core/runtime/lifecycle.js +2 -2
- package/dist/core/runtime/revive.js +2 -2
- package/dist/core/runtime/runner/blaxel/client.d.ts +4 -0
- package/dist/core/runtime/runner/blaxel/client.js +1 -1
- package/dist/core/runtime/runner/blaxel/runner.d.ts +2 -3
- package/dist/core/runtime/runner/blaxel/runner.js +3 -3
- package/dist/core/runtime/runner/delete-sandboxes.d.ts +5 -0
- package/dist/core/runtime/runner/delete-sandboxes.js +6 -1
- package/dist/core/runtime/runner/types.d.ts +19 -3
- package/dist/core/runtime/tmux-bindings.js +3 -3
- package/dist/daemon/api/bridge.d.ts +5 -0
- package/dist/daemon/api/bridge.js +3 -3
- package/dist/daemon/api/canvas-host.js +1 -1
- package/dist/daemon/api/document-page.d.ts +12 -1
- package/dist/daemon/api/document-page.js +6 -6
- package/dist/daemon/api/handlers/crons.d.ts +2 -0
- package/dist/daemon/api/handlers/crons.js +1 -1
- package/dist/daemon/api/handlers/inbox.js +1 -1
- package/dist/daemon/api/handlers/nodes.js +1 -1
- package/dist/daemon/api/handlers/review-comments.js +1 -1
- package/dist/daemon/api/handlers/reviews.js +1 -1
- package/dist/daemon/api/map.js +2 -2
- package/dist/daemon/api/operations.js +1 -1
- package/dist/daemon/api/review-page.d.ts +3 -0
- package/dist/daemon/api/review-page.js +13 -0
- package/dist/daemon/broker-memory-cap.d.ts +9 -0
- package/dist/daemon/broker-memory-cap.js +2 -0
- package/dist/daemon/broker-signals/bus.d.ts +1 -1
- package/dist/daemon/broker-signals/bus.js +1 -1
- package/dist/daemon/cron/ended.d.ts +3 -0
- package/dist/daemon/cron/ended.js +2 -2
- package/dist/daemon/cron/lease-recovery.js +1 -1
- package/dist/daemon/cron/machine-fire.d.ts +9 -2
- package/dist/daemon/cron/machine-fire.js +1 -1
- package/dist/daemon/cron/passes.js +1 -1
- package/dist/daemon/cron-run.js +2 -2
- package/dist/daemon/crtrd.js +14 -14
- package/dist/daemon/machine-daemon.js +1 -1
- package/dist/daemon/machine-link/client.js +1 -1
- package/dist/daemon/reconcilers/fault-retry-backstop.js +1 -1
- package/dist/daemon/reconcilers/idle-sandbox.d.ts +1 -1
- package/dist/daemon/reconcilers/idle-sandbox.js +2 -2
- package/dist/daemon/reconcilers/node-lifecycle/remote-wake.js +2 -2
- package/dist/daemon/review/comment-notify.js +2 -2
- package/dist/daemon/review/deliver.d.ts +2 -2
- package/dist/daemon/review/deliver.js +6 -2
- package/dist/daemon/review/finish.js +1 -1
- package/dist/doc-editor/Geist-Variable.woff2 +0 -0
- package/dist/doc-editor/GeistMono-Variable.woff2 +0 -0
- package/dist/doc-editor/editor.css +1 -1
- package/dist/doc-editor/review.css +2 -0
- package/dist/doc-editor/review.js +149 -0
- package/dist/pi-extensions/canvas-review-boundary.js +3 -3
- package/docs/sdk/release-notes.md +6 -0
- package/package.json +13 -4
- package/packages/crouter-api/dist/api/client.js +0 -3
- package/packages/crouter-api/dist/api/contract.js +1 -1
- package/packages/crouter-api/dist/api/routes.js +0 -1
- package/packages/crouter-api/dist/clients/attach/chrome/canvas-panels.js +3 -3
- package/packages/crouter-api/dist/clients/attach/chrome/inbox-strip.js +5 -5
- package/packages/crouter-api/dist/clients/attach/chrome/roster.js +17 -28
- package/packages/crouter-api/dist/clients/attach/chrome/status-line.js +2 -7
- package/packages/crouter-api/dist/clients/attach/chrome/ticket-panel.js +1 -1
- package/packages/crouter-api/dist/clients/attach/input/capabilities.js +2 -1
- package/packages/crouter-api/dist/clients/attach/input/controller.js +17 -3
- package/packages/crouter-api/dist/clients/attach/input/overlay-owner.js +0 -7
- package/packages/crouter-api/dist/clients/attach/overlays/graph.js +4 -3
- package/packages/crouter-api/dist/clients/attach/render/chat-view.js +9 -0
- package/packages/crouter-api/dist/clients/attach/session/chrome-refresh.js +6 -3
- package/packages/crouter-api/dist/clients/attach/session/connection.js +53 -53
- package/packages/crouter-api/dist/clients/attach/session/document-links.js +1 -1
- package/packages/crouter-api/dist/clients/attach/session/identity.js +1 -0
- package/packages/crouter-api/dist/clients/attach/session/input-wiring.js +4 -3
- package/packages/crouter-api/dist/clients/attach/session/keys.js +11 -5
- package/packages/crouter-api/dist/clients/attach/session/pane-tag.js +7 -1
- package/packages/crouter-api/dist/clients/attach/session/reconnect.js +3 -3
- package/packages/crouter-api/dist/clients/attach/session/surface-host.js +0 -17
- package/packages/crouter-api/dist/clients/attach/session/teardown.js +7 -4
- package/packages/crouter-api/dist/clients/attach/viewer.js +77 -67
- package/packages/crouter-api/dist/clients/{inbox/review/roundtrip.js → editor-roundtrip.js} +1 -1
- package/packages/crouter-api/dist/clients/inbox/controller.js +12 -31
- package/packages/crouter-api/dist/clients/inbox/dto-adapt.js +1 -0
- package/packages/crouter-api/dist/clients/inbox/tui/page-body.js +0 -7
- package/packages/crouter-api/dist/clients/inbox/tui/render.js +0 -7
- package/packages/crouter-api/dist/clients/open-browser.js +6 -0
- package/packages/crouter-api/dist/commands/human/review.js +17 -18
- package/packages/crouter-api/dist/commands/node/wait.js +2 -10
- package/packages/crouter-api/dist/commands/sys/context/admin/shell.js +1 -1
- package/packages/crouter-api/dist/core/broker-client/client.js +20 -10
- package/packages/crouter-api/dist/core/canvas/crons.js +26 -10
- package/packages/crouter-api/dist/core/canvas/executions.js +7 -2
- package/packages/crouter-api/dist/core/canvas/schema-version.js +1 -1
- package/packages/crouter-api/dist/core/command.js +3 -0
- package/packages/crouter-api/dist/core/feed/messages.js +15 -0
- package/packages/crouter-api/dist/core/human/page-markdown.js +2 -6
- package/packages/crouter-api/dist/core/human/tickets.js +2 -11
- package/packages/crouter-api/dist/core/keybindings/attach-control.js +0 -1
- package/packages/crouter-api/dist/core/keybindings/catalog.js +1 -3
- package/packages/crouter-api/dist/core/review/anchors.js +91 -0
- package/packages/crouter-api/dist/core/review/comments.js +27 -46
- package/packages/crouter-api/dist/core/review/companion.js +5 -9
- package/packages/crouter-api/dist/core/review/document.js +17 -89
- package/packages/crouter-api/dist/core/review/project.js +2 -1
- package/packages/crouter-api/dist/core/review/types.js +2 -2
- package/packages/crouter-api/dist/core/runtime/bearings.js +2 -2
- package/packages/crouter-api/dist/core/runtime/lifecycle.js +3 -0
- package/packages/crouter-api/dist/core/runtime/revive.js +5 -25
- package/packages/crouter-api/dist/core/runtime/runner/blaxel/client.js +15 -8
- package/packages/crouter-api/dist/core/runtime/runner/blaxel/runner.js +60 -19
- package/packages/crouter-api/dist/core/runtime/runner/delete-sandboxes.js +18 -2
- package/packages/crouter-api/dist/core/runtime/tmux-bindings.js +0 -5
- package/packages/crouter-api/dist/daemon/api/map.js +2 -6
- package/packages/crouter-api/dist/daemon/api/operations.js +2 -2
- package/packages/crouter-api/dist/daemon/broker-signals/bus.js +1 -1
- package/packages/crouter-api/dist/daemon/cron/ended.js +22 -11
- package/packages/crouter-api/dist/daemon/cron/machine-fire.js +69 -6
- package/packages/crouter-api/dist/daemon/reconcilers/node-lifecycle/remote-wake.js +2 -2
- package/packages/crouter-api/dist/daemon/review/deliver.js +4 -3
- package/packages/crouter-api/dist/daemon/review/finish.js +26 -47
- package/packages/crouter-api/package.json +1 -1
- package/packages/crouter-identity/package.json +1 -1
- package/packages/crouter-plugin/package.json +3 -3
- package/runtime.lock.json +1740 -505
- package/dist/clients/attach/overlays/file-review.d.ts +0 -10
- package/dist/clients/attach/overlays/file-review.js +0 -2
- package/dist/clients/inbox/review/anchors.d.ts +0 -41
- package/dist/clients/inbox/review/anchors.js +0 -1
- package/dist/clients/inbox/review/comments-client.d.ts +0 -74
- package/dist/clients/inbox/review/comments-client.js +0 -1
- package/dist/clients/inbox/review/companion-pane.d.ts +0 -47
- package/dist/clients/inbox/review/companion-pane.js +0 -1
- package/dist/clients/inbox/review/document-surface.d.ts +0 -212
- package/dist/clients/inbox/review/document-surface.js +0 -2
- package/dist/clients/inbox/review/frame.d.ts +0 -57
- package/dist/clients/inbox/review/frame.js +0 -1
- package/dist/clients/inbox/review/keys.d.ts +0 -69
- package/dist/clients/inbox/review/keys.js +0 -1
- package/dist/clients/inbox/review/launch.d.ts +0 -16
- package/dist/clients/inbox/review/launch.js +0 -1
- package/dist/clients/inbox/review/live-source.d.ts +0 -24
- package/dist/clients/inbox/review/live-source.js +0 -1
- package/dist/clients/inbox/review/nvim.d.ts +0 -15
- package/dist/clients/inbox/review/nvim.js +0 -1
- package/dist/clients/inbox/review/remap.d.ts +0 -51
- package/dist/clients/inbox/review/remap.js +0 -1
- package/dist/clients/inbox/review/review-client.d.ts +0 -43
- package/dist/clients/inbox/review/review-client.js +0 -1
- package/dist/clients/inbox/review/roundtrip.js +0 -3
- package/dist/clients/inbox/review/state.d.ts +0 -153
- package/dist/clients/inbox/review/state.js +0 -4
- package/dist/clients/inbox/review-adapter.d.ts +0 -17
- package/dist/clients/inbox/review-adapter.js +0 -1
- package/dist/core/review/remap.d.ts +0 -24
- package/dist/core/review/remap.js +0 -19
- package/dist/core/review/signal.d.ts +0 -5
- package/dist/core/review/signal.js +0 -1
- package/dist/core/runtime/starting-screen.d.ts +0 -12
- package/dist/core/runtime/starting-screen.js +0 -9
- package/packages/crouter-api/dist/clients/attach/overlays/file-review.js +0 -146
- package/packages/crouter-api/dist/clients/inbox/review/anchors.js +0 -89
- package/packages/crouter-api/dist/clients/inbox/review/comments-client.js +0 -103
- package/packages/crouter-api/dist/clients/inbox/review/companion-pane.js +0 -109
- package/packages/crouter-api/dist/clients/inbox/review/document-surface.js +0 -1268
- package/packages/crouter-api/dist/clients/inbox/review/frame.js +0 -309
- package/packages/crouter-api/dist/clients/inbox/review/keys.js +0 -133
- package/packages/crouter-api/dist/clients/inbox/review/launch.js +0 -170
- package/packages/crouter-api/dist/clients/inbox/review/live-source.js +0 -160
- package/packages/crouter-api/dist/clients/inbox/review/nvim.js +0 -43
- package/packages/crouter-api/dist/clients/inbox/review/remap.js +0 -157
- package/packages/crouter-api/dist/clients/inbox/review/review-client.js +0 -125
- package/packages/crouter-api/dist/clients/inbox/review/state.js +0 -315
- package/packages/crouter-api/dist/clients/inbox/review-adapter.js +0 -43
- package/packages/crouter-api/dist/core/review/signal.js +0 -12
- package/packages/crouter-api/dist/core/termrender/code-doc.js +0 -92
- /package/dist/clients/{inbox/review/roundtrip.d.ts → editor-roundtrip.d.ts} +0 -0
|
@@ -1,315 +0,0 @@
|
|
|
1
|
-
import { verticalCursor, wordLeftIndex, wordRightIndex } from '../tui/render.js';
|
|
2
|
-
import { unitIndexForLine, unitRangeForSpan } from './anchors.js';
|
|
3
|
-
/** Best unit for a source line: the NARROWEST unit containing it — code/table
|
|
4
|
-
* chrome units carry their whole block's range and sit before the per-line
|
|
5
|
-
* content units in rendered order, so "first whose end reaches the line"
|
|
6
|
-
* would wrongly pick the chrome over the exact code line. A line no unit
|
|
7
|
-
* contains (a blank separator) snaps forward to the next unit; past the end
|
|
8
|
-
* clamps to the last. */
|
|
9
|
-
export function initReviewState(sourceLines, anchor, comments, sourceRevision) {
|
|
10
|
-
const safe = anchor.units.length > 0
|
|
11
|
-
? anchor
|
|
12
|
-
: { units: [{ start: 1, end: Math.max(1, sourceLines.length), firstRow: 0, lastRow: 0 }], rowUnits: anchor.rowUnits };
|
|
13
|
-
return {
|
|
14
|
-
sourceLines,
|
|
15
|
-
units: safe.units,
|
|
16
|
-
rowUnits: safe.rowUnits,
|
|
17
|
-
comments: [...comments],
|
|
18
|
-
sourceRevision,
|
|
19
|
-
detached: Object.fromEntries(comments.flatMap((comment) => comment.anchorStatus === 'detached'
|
|
20
|
-
? [[comment.id, comment.originalRange ?? { line: comment.line, endLine: comment.endLine }]]
|
|
21
|
-
: [])),
|
|
22
|
-
activeUnit: comments.length > 0 ? unitIndexForLine(safe.units, comments[0].line) : 0,
|
|
23
|
-
selectionAnchor: null,
|
|
24
|
-
scroll: 0,
|
|
25
|
-
hscroll: 0,
|
|
26
|
-
mode: 'view',
|
|
27
|
-
compose: null,
|
|
28
|
-
listIndex: 0,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
export function selectedUnitBounds(state) {
|
|
32
|
-
const sel = state.selectionAnchor ?? state.activeUnit;
|
|
33
|
-
return { lo: Math.min(state.activeUnit, sel), hi: Math.max(state.activeUnit, sel) };
|
|
34
|
-
}
|
|
35
|
-
/** Source-line anchor of the current unit selection — what a committed
|
|
36
|
-
* comment records as `line`/`endLine`. Whole-block chrome units can carry a
|
|
37
|
-
* wider range than their neighbors, so take the min/max over the selection
|
|
38
|
-
* rather than trusting the endpoints alone. */
|
|
39
|
-
export function currentAnchor(state) {
|
|
40
|
-
const { lo, hi } = selectedUnitBounds(state);
|
|
41
|
-
let line = Number.POSITIVE_INFINITY;
|
|
42
|
-
let endLine = 0;
|
|
43
|
-
for (let i = lo; i <= hi; i++) {
|
|
44
|
-
const u = state.units[i];
|
|
45
|
-
if (u === undefined)
|
|
46
|
-
continue;
|
|
47
|
-
line = Math.min(line, u.start);
|
|
48
|
-
endLine = Math.max(endLine, u.end);
|
|
49
|
-
}
|
|
50
|
-
if (!Number.isFinite(line))
|
|
51
|
-
return { line: 1, endLine: Math.max(1, state.sourceLines.length) };
|
|
52
|
-
return { line, endLine: Math.max(line, endLine) };
|
|
53
|
-
}
|
|
54
|
-
export function moveActiveUnit(state, delta, extend) {
|
|
55
|
-
const last = Math.max(0, state.units.length - 1);
|
|
56
|
-
const next = Math.max(0, Math.min(last, state.activeUnit + delta));
|
|
57
|
-
if (!extend)
|
|
58
|
-
return { ...state, activeUnit: next, selectionAnchor: null };
|
|
59
|
-
return { ...state, activeUnit: next, selectionAnchor: state.selectionAnchor ?? state.activeUnit };
|
|
60
|
-
}
|
|
61
|
-
/** Unit indices overlapped by any existing comment's source range. A projected
|
|
62
|
-
* range lying wholly past the last unit (the file shrank before its range was
|
|
63
|
-
* remapped) still gets a marker on its clamped unit, so every comment is
|
|
64
|
-
* visible somewhere in the document. */
|
|
65
|
-
export function commentedUnitSet(state) {
|
|
66
|
-
const out = new Set();
|
|
67
|
-
for (const c of state.comments) {
|
|
68
|
-
if (c.status === 'deleted' || c.anchorStatus === 'detached')
|
|
69
|
-
continue;
|
|
70
|
-
let hit = false;
|
|
71
|
-
state.units.forEach((u, i) => {
|
|
72
|
-
if (u.start <= c.endLine && u.end >= c.line) {
|
|
73
|
-
out.add(i);
|
|
74
|
-
hit = true;
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
if (!hit)
|
|
78
|
-
out.add(unitIndexForLine(state.units, c.line));
|
|
79
|
-
}
|
|
80
|
-
return out;
|
|
81
|
-
}
|
|
82
|
-
/** First/last rendered-row indices spanned by units `lo..hi`, or null when
|
|
83
|
-
* the indices fall outside the unit list. */
|
|
84
|
-
export function anchorRowRange(units, lo, hi) {
|
|
85
|
-
const a = units[lo];
|
|
86
|
-
const b = units[hi];
|
|
87
|
-
if (a === undefined || b === undefined)
|
|
88
|
-
return null;
|
|
89
|
-
return { first: a.firstRow, last: b.lastRow };
|
|
90
|
-
}
|
|
91
|
-
/** Minimal scroll adjustment that keeps rows `first..last` visible with
|
|
92
|
-
* `margin` rows of context (the margin yields whenever honoring it would push
|
|
93
|
-
* either edge of the span out of view); a taller-than-view span pins `first`
|
|
94
|
-
* at the top — one row down when scrolled, so the `↑ more above` indicator
|
|
95
|
-
* overwrites the preceding row, never the pinned one. Always returns a scroll
|
|
96
|
-
* clamped to the document. */
|
|
97
|
-
export function scrollToReveal(scroll, first, last, bodyHeight, total, margin = 2) {
|
|
98
|
-
const maxScroll = Math.max(0, total - bodyHeight);
|
|
99
|
-
let next = Math.max(0, Math.min(scroll, maxScroll));
|
|
100
|
-
if (last - first + 1 >= bodyHeight)
|
|
101
|
-
return Math.max(0, Math.min(Math.max(0, first - 1), maxScroll));
|
|
102
|
-
if (first - margin < next)
|
|
103
|
-
next = Math.max(first - margin, last - (bodyHeight - 1));
|
|
104
|
-
else if (last + margin > next + bodyHeight - 1)
|
|
105
|
-
next = Math.min(last + margin - (bodyHeight - 1), first);
|
|
106
|
-
return Math.max(0, Math.min(next, maxScroll));
|
|
107
|
-
}
|
|
108
|
-
/** Auto-scroll so the active unit (the moving edge of a selection) is
|
|
109
|
-
* visible. The wheel free-scrolls and is untouched until the next anchor move. */
|
|
110
|
-
export function ensureAnchorVisible(state, doc, bodyHeight) {
|
|
111
|
-
const range = anchorRowRange(state.units, state.activeUnit, state.activeUnit);
|
|
112
|
-
if (range === null)
|
|
113
|
-
return state;
|
|
114
|
-
const scroll = scrollToReveal(state.scroll, range.first, range.last, bodyHeight, doc.lines.length);
|
|
115
|
-
return scroll === state.scroll ? state : { ...state, scroll };
|
|
116
|
-
}
|
|
117
|
-
export function scrollBy(state, delta, bodyHeight, totalLines) {
|
|
118
|
-
const maxScroll = Math.max(0, totalLines - bodyHeight);
|
|
119
|
-
return { ...state, scroll: Math.max(0, Math.min(state.scroll + delta, maxScroll)) };
|
|
120
|
-
}
|
|
121
|
-
/** Rows one `u`/`d` press travels: half the visible body, and never fewer than
|
|
122
|
-
* one row, so a diagram taller than the pane cannot hold the document still. */
|
|
123
|
-
export function halfPageRows(bodyHeight) {
|
|
124
|
-
return Math.max(1, Math.floor(bodyHeight / 2));
|
|
125
|
-
}
|
|
126
|
-
/** Move the view by `rows` and carry the anchored unit the same distance, so
|
|
127
|
-
* the selection keeps its place on screen rather than being left behind. The
|
|
128
|
-
* selection lands on the unit owning the row it would occupy after the move,
|
|
129
|
-
* clamped into the rows the frame actually paints; at the end of the document,
|
|
130
|
-
* where the view can no longer move, the selection walks the rest on its own. */
|
|
131
|
-
export function moveViewRows(state, rows, bodyHeight, totalRows) {
|
|
132
|
-
if (rows === 0)
|
|
133
|
-
return state;
|
|
134
|
-
const direction = rows > 0 ? 1 : -1;
|
|
135
|
-
const maxScroll = Math.max(0, totalRows - bodyHeight);
|
|
136
|
-
const scroll = Math.max(0, Math.min(state.scroll + rows, maxScroll));
|
|
137
|
-
// The frame overwrites the first and last body rows with its `more above` /
|
|
138
|
-
// `more below` indicators, and an indicator row carries no cursor, so the
|
|
139
|
-
// selection is kept inside the rows that remain the document's own.
|
|
140
|
-
const lo = scroll + (scroll > 0 ? 1 : 0);
|
|
141
|
-
const hi = Math.max(lo, scroll + bodyHeight - 1 - (scroll + bodyHeight < totalRows ? 1 : 0));
|
|
142
|
-
const anchorRow = state.units[state.activeUnit]?.firstRow ?? state.scroll;
|
|
143
|
-
const target = Math.max(lo, Math.min(anchorRow + rows, hi));
|
|
144
|
-
const activeUnit = unitNearRow(state, target, lo, hi, direction) ?? state.activeUnit;
|
|
145
|
-
if (scroll === state.scroll && activeUnit === state.activeUnit)
|
|
146
|
-
return state;
|
|
147
|
-
return { ...state, scroll, activeUnit, selectionAnchor: null };
|
|
148
|
-
}
|
|
149
|
-
/** The unit owning the row nearest `row` within `lo..hi`, preferring the
|
|
150
|
-
* direction of travel. Separator rows own no unit, hence the search. */
|
|
151
|
-
function unitNearRow(state, row, lo, hi, direction) {
|
|
152
|
-
const last = Math.max(0, state.units.length - 1);
|
|
153
|
-
for (let step = 0; step <= hi - lo; step++) {
|
|
154
|
-
for (const candidate of [row + step * direction, row - step * direction]) {
|
|
155
|
-
if (candidate < lo || candidate > hi)
|
|
156
|
-
continue;
|
|
157
|
-
const unit = state.rowUnits[candidate];
|
|
158
|
-
if (unit === null || unit === undefined)
|
|
159
|
-
continue;
|
|
160
|
-
return Math.max(0, Math.min(last, unit));
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
return null;
|
|
164
|
-
}
|
|
165
|
-
export function openComposeNew(state) {
|
|
166
|
-
return { ...state, mode: 'compose', compose: { buffer: '', cursor: 0, editingId: null, returnMode: 'view', anchor: currentAnchor(state) } };
|
|
167
|
-
}
|
|
168
|
-
export function openComposeEdit(state, index) {
|
|
169
|
-
const comment = state.comments[index];
|
|
170
|
-
if (comment === undefined)
|
|
171
|
-
return state;
|
|
172
|
-
const buffer = comment.comment;
|
|
173
|
-
const { lo, hi } = unitRangeForSpan(state.units, comment.line, comment.endLine);
|
|
174
|
-
return {
|
|
175
|
-
...state,
|
|
176
|
-
activeUnit: hi,
|
|
177
|
-
selectionAnchor: lo === hi ? null : lo,
|
|
178
|
-
mode: 'compose',
|
|
179
|
-
compose: { buffer, cursor: [...buffer].length, editingId: comment.id, returnMode: 'list', anchor: { line: comment.line, endLine: comment.endLine } },
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
export function closeCompose(state) {
|
|
183
|
-
const returnMode = state.compose?.returnMode ?? 'view';
|
|
184
|
-
return { ...state, mode: returnMode, compose: null };
|
|
185
|
-
}
|
|
186
|
-
/** Closes compose and returns the daemon mutation payload. The daemon projection, not this reducer, repaints comments. */
|
|
187
|
-
export function commitCompose(state) {
|
|
188
|
-
const c = state.compose;
|
|
189
|
-
if (c === null || c === undefined)
|
|
190
|
-
return { state, commit: null };
|
|
191
|
-
const text = c.buffer.trim();
|
|
192
|
-
if (text.length === 0)
|
|
193
|
-
return { state: closeCompose(state), commit: null };
|
|
194
|
-
return {
|
|
195
|
-
state: closeCompose(state),
|
|
196
|
-
commit: { editingId: c.editingId, anchor: c.anchor, text },
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
export function openList(state) {
|
|
200
|
-
return { ...state, mode: 'list', listIndex: Math.max(0, Math.min(state.listIndex, state.comments.length - 1)) };
|
|
201
|
-
}
|
|
202
|
-
export function closeList(state) {
|
|
203
|
-
return { ...state, mode: 'view' };
|
|
204
|
-
}
|
|
205
|
-
export function moveListIndex(state, delta) {
|
|
206
|
-
if (state.comments.length === 0)
|
|
207
|
-
return state;
|
|
208
|
-
const next = Math.max(0, Math.min(state.comments.length - 1, state.listIndex + delta));
|
|
209
|
-
return { ...state, listIndex: next };
|
|
210
|
-
}
|
|
211
|
-
export function deleteAtListIndex(state) {
|
|
212
|
-
const comment = state.comments[state.listIndex];
|
|
213
|
-
return { state, id: comment?.id ?? null };
|
|
214
|
-
}
|
|
215
|
-
export function undoLast(state) {
|
|
216
|
-
return { state, id: state.comments.at(-1)?.id ?? null };
|
|
217
|
-
}
|
|
218
|
-
export function openHelp(state) {
|
|
219
|
-
return { ...state, mode: 'help' };
|
|
220
|
-
}
|
|
221
|
-
export function closeHelp(state) {
|
|
222
|
-
return { ...state, mode: 'view' };
|
|
223
|
-
}
|
|
224
|
-
// ── Multi-line text-buffer helpers (flat string + code-point cursor) ────────
|
|
225
|
-
function codePoints(s) {
|
|
226
|
-
return [...s];
|
|
227
|
-
}
|
|
228
|
-
// A single physical keypress (including Enter) almost always arrives as its
|
|
229
|
-
// own 'data' event, so parseKeypress's per-event key flags cover the normal
|
|
230
|
-
// typing path. A chunk longer than one character is a paste (or, rarely,
|
|
231
|
-
// several keystrokes the OS coalesced into one read) and is never re-parsed
|
|
232
|
-
// for key semantics — an embedded CR there means a pasted newline, not a
|
|
233
|
-
// commit. Mirrors tui/input.ts's paste cleaning: strip escape sequences,
|
|
234
|
-
// normalize CR/CRLF to LF, drop remaining control bytes, keep LF.
|
|
235
|
-
export function cleanPastedText(input) {
|
|
236
|
-
return input
|
|
237
|
-
.replace(/\x1b\[20[01]~/g, '')
|
|
238
|
-
.replace(/\x1b\[[0-9;?]*[a-zA-Z]/g, '')
|
|
239
|
-
.replace(/\r\n?/g, '\n')
|
|
240
|
-
.replace(/[\x00-\x09\x0B-\x1F\x7F]/g, '');
|
|
241
|
-
}
|
|
242
|
-
export function textInsert(buffer, cursor, text) {
|
|
243
|
-
const chars = codePoints(buffer);
|
|
244
|
-
const at = Math.max(0, Math.min(cursor, chars.length));
|
|
245
|
-
const next = [...chars.slice(0, at), ...codePoints(text), ...chars.slice(at)].join('');
|
|
246
|
-
return { buffer: next, cursor: at + codePoints(text).length };
|
|
247
|
-
}
|
|
248
|
-
export function textBackspace(buffer, cursor) {
|
|
249
|
-
if (cursor <= 0)
|
|
250
|
-
return { buffer, cursor };
|
|
251
|
-
const chars = codePoints(buffer);
|
|
252
|
-
return { buffer: [...chars.slice(0, cursor - 1), ...chars.slice(cursor)].join(''), cursor: cursor - 1 };
|
|
253
|
-
}
|
|
254
|
-
export function textDelete(buffer, cursor) {
|
|
255
|
-
const chars = codePoints(buffer);
|
|
256
|
-
if (cursor >= chars.length)
|
|
257
|
-
return { buffer, cursor };
|
|
258
|
-
return { buffer: [...chars.slice(0, cursor), ...chars.slice(cursor + 1)].join(''), cursor };
|
|
259
|
-
}
|
|
260
|
-
function lineBoundsAt(chars, cursor) {
|
|
261
|
-
let start = cursor;
|
|
262
|
-
while (start > 0 && chars[start - 1] !== '\n')
|
|
263
|
-
start--;
|
|
264
|
-
let end = cursor;
|
|
265
|
-
while (end < chars.length && chars[end] !== '\n')
|
|
266
|
-
end++;
|
|
267
|
-
return { start, end };
|
|
268
|
-
}
|
|
269
|
-
export function textHome(buffer, cursor) {
|
|
270
|
-
return lineBoundsAt(codePoints(buffer), cursor).start;
|
|
271
|
-
}
|
|
272
|
-
export function textEnd(buffer, cursor) {
|
|
273
|
-
return lineBoundsAt(codePoints(buffer), cursor).end;
|
|
274
|
-
}
|
|
275
|
-
export function textVertical(buffer, cursor, delta) {
|
|
276
|
-
const chars = codePoints(buffer);
|
|
277
|
-
const { start, end } = lineBoundsAt(chars, cursor);
|
|
278
|
-
const col = cursor - start;
|
|
279
|
-
if (delta < 0) {
|
|
280
|
-
if (start === 0)
|
|
281
|
-
return cursor;
|
|
282
|
-
const prevEnd = start - 1; // the '\n' just before this line
|
|
283
|
-
const prevStart = lineBoundsAt(chars, prevEnd).start;
|
|
284
|
-
return Math.min(prevEnd, prevStart + col);
|
|
285
|
-
}
|
|
286
|
-
if (end >= chars.length)
|
|
287
|
-
return cursor;
|
|
288
|
-
const nextStart = end + 1;
|
|
289
|
-
const nextEnd = lineBoundsAt(chars, nextStart).end;
|
|
290
|
-
return Math.min(nextEnd, nextStart + col);
|
|
291
|
-
}
|
|
292
|
-
/** Vertical motion by *visual* row (what up/down mean in a wrapped compose box):
|
|
293
|
-
* a long soft-wrapped comment has many rows even though it is one logical
|
|
294
|
-
* line. Shares `verticalCursor` with the frame renderer's own wrap. */
|
|
295
|
-
export function textVerticalWrapped(buffer, cursor, delta, width) {
|
|
296
|
-
return verticalCursor(buffer, cursor, delta, width);
|
|
297
|
-
}
|
|
298
|
-
/** Start of the word before the cursor (readline alt-b / alt+left). Shares one
|
|
299
|
-
* word-motion implementation with the page compose box. */
|
|
300
|
-
export function textWordLeft(buffer, cursor) {
|
|
301
|
-
return wordLeftIndex(buffer, cursor);
|
|
302
|
-
}
|
|
303
|
-
/** Just past the end of the word after the cursor (readline alt-f / alt+right). */
|
|
304
|
-
export function textWordRight(buffer, cursor) {
|
|
305
|
-
return wordRightIndex(buffer, cursor);
|
|
306
|
-
}
|
|
307
|
-
/** Delete back to the start of the previous word (alt+backspace / ctrl+w). */
|
|
308
|
-
export function textWordBackspace(buffer, cursor) {
|
|
309
|
-
const chars = codePoints(buffer);
|
|
310
|
-
const at = Math.max(0, Math.min(cursor, chars.length));
|
|
311
|
-
const to = textWordLeft(buffer, at);
|
|
312
|
-
if (to === at)
|
|
313
|
-
return { buffer, cursor: at };
|
|
314
|
-
return { buffer: [...chars.slice(0, to), ...chars.slice(at)].join(''), cursor: to };
|
|
315
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { openReviewWindow } from './review/launch.js';
|
|
2
|
-
import { createReviewClient, ReviewTerminalError, terminalRefusalNotice } from './review/review-client.js';
|
|
3
|
-
/** Resolve a durable review ticket and open it in its own tmux window. */
|
|
4
|
-
export class ReviewAdapter {
|
|
5
|
-
opts;
|
|
6
|
-
running = null;
|
|
7
|
-
stopped = false;
|
|
8
|
-
constructor(opts) {
|
|
9
|
-
this.opts = opts;
|
|
10
|
-
}
|
|
11
|
-
/** Resolves true once the review window has opened and been selected. */
|
|
12
|
-
start() {
|
|
13
|
-
if (this.running !== null)
|
|
14
|
-
return this.running;
|
|
15
|
-
this.running = this.run();
|
|
16
|
-
return this.running;
|
|
17
|
-
}
|
|
18
|
-
async stop() {
|
|
19
|
-
this.stopped = true;
|
|
20
|
-
if (this.running !== null)
|
|
21
|
-
await this.running;
|
|
22
|
-
}
|
|
23
|
-
async run() {
|
|
24
|
-
if (this.opts.host.capabilities.remote) {
|
|
25
|
-
this.opts.host.notice('The review is unavailable in a remote attach — the file and companion live on the host.');
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
let review;
|
|
29
|
-
try {
|
|
30
|
-
review = await createReviewClient().byId(this.opts.reviewId);
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
this.opts.host.notice(noticeForLookupFailure(error));
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
return !this.stopped && openReviewWindow(this.opts.host, review);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
function noticeForLookupFailure(error) {
|
|
40
|
-
if (error instanceof ReviewTerminalError)
|
|
41
|
-
return terminalRefusalNotice(error);
|
|
42
|
-
return error instanceof Error ? error.message : String(error);
|
|
43
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { activityPath, signalActivity, watchActivity } from '../activity-signal.js';
|
|
2
|
-
/** Signal one durable review mutation to every open viewer without watching every review directory. */
|
|
3
|
-
export function reviewActivityPath() {
|
|
4
|
-
return activityPath('review-activity');
|
|
5
|
-
}
|
|
6
|
-
/** Signal one review mutation (comment create/edit/resolve/delete/reanchor/delivery) to every open review surface. */
|
|
7
|
-
export function signalReviewActivity() {
|
|
8
|
-
signalActivity('review-activity');
|
|
9
|
-
}
|
|
10
|
-
export function watchReviewActivity(onChange) {
|
|
11
|
-
return watchActivity('review-activity', onChange);
|
|
12
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { extname } from 'node:path';
|
|
2
|
-
import { documentLines } from '../document-lines.js';
|
|
3
|
-
import { renderMarkdownWithMap } from './termrender.js';
|
|
4
|
-
// ── Source files as review documents ─────────────────────────────────────────
|
|
5
|
-
//
|
|
6
|
-
// A review ticket may point at a .ts/.py/.sql source file, not just a .md
|
|
7
|
-
// artifact. Every surface still wants ONE rendering story, so a source file is
|
|
8
|
-
// presented as a single fenced code block: termrender (Pygments) and the
|
|
9
|
-
// browser (highlight.js) then syntax-highlight it for free, and the fence's
|
|
10
|
-
// language comes from the file extension.
|
|
11
|
-
//
|
|
12
|
-
// The one cost is a line shift: the fence's opening line makes source line N
|
|
13
|
-
// land on line N+1 of the wrapped document. `codeRenderedDoc` folds that back
|
|
14
|
-
// out so every span/anchor the surfaces expose is a real SOURCE line number.
|
|
15
|
-
/** Extension → fence info string. Names are the ones Pygments (termrender) and
|
|
16
|
-
* highlight.js (browser) both accept, so one map serves every surface. */
|
|
17
|
-
const FENCE_BY_EXT = {
|
|
18
|
-
'.ts': 'typescript', '.mts': 'typescript', '.cts': 'typescript', '.tsx': 'tsx',
|
|
19
|
-
'.js': 'javascript', '.mjs': 'javascript', '.cjs': 'javascript', '.jsx': 'jsx',
|
|
20
|
-
'.py': 'python', '.rb': 'ruby', '.go': 'go', '.rs': 'rust', '.java': 'java',
|
|
21
|
-
'.c': 'c', '.h': 'c', '.cc': 'cpp', '.cpp': 'cpp', '.hpp': 'cpp', '.cs': 'csharp',
|
|
22
|
-
'.swift': 'swift', '.kt': 'kotlin', '.php': 'php', '.lua': 'lua', '.pl': 'perl',
|
|
23
|
-
'.sh': 'bash', '.bash': 'bash', '.zsh': 'bash', '.fish': 'fish',
|
|
24
|
-
'.sql': 'sql', '.json': 'json', '.jsonc': 'json', '.yaml': 'yaml', '.yml': 'yaml',
|
|
25
|
-
'.toml': 'toml', '.ini': 'ini', '.xml': 'xml', '.html': 'html', '.htm': 'html',
|
|
26
|
-
'.css': 'css', '.scss': 'scss', '.less': 'less', '.vim': 'vim', '.el': 'lisp',
|
|
27
|
-
'.ex': 'elixir', '.exs': 'elixir', '.erl': 'erlang', '.hs': 'haskell',
|
|
28
|
-
'.scala': 'scala', '.dart': 'dart', '.r': 'r', '.jl': 'julia', '.zig': 'zig',
|
|
29
|
-
'.tf': 'terraform', '.proto': 'protobuf', '.graphql': 'graphql', '.gql': 'graphql',
|
|
30
|
-
'.dockerfile': 'dockerfile', '.diff': 'diff', '.patch': 'diff', '.csv': 'text',
|
|
31
|
-
'.txt': 'text', '.log': 'text', '.env': 'bash', '.mk': 'makefile',
|
|
32
|
-
};
|
|
33
|
-
/** Markdown extensions render as a DOCUMENT (headings, tables, Mermaid); every
|
|
34
|
-
* other text file renders as code. */
|
|
35
|
-
const MARKDOWN_EXTENSIONS = new Set(['.md', '.markdown', '.mdown', '.mkd']);
|
|
36
|
-
export function isMarkdownFile(file) {
|
|
37
|
-
return MARKDOWN_EXTENSIONS.has(extname(file).toLowerCase());
|
|
38
|
-
}
|
|
39
|
-
/** Fence info string for a source file — `text` when the extension is unknown,
|
|
40
|
-
* which every highlighter degrades to plain text on. */
|
|
41
|
-
export function fenceLanguageFor(file) {
|
|
42
|
-
const ext = extname(file).toLowerCase();
|
|
43
|
-
if (ext === '') {
|
|
44
|
-
// Extensionless but conventionally-named files still have obvious types.
|
|
45
|
-
const base = file.slice(file.lastIndexOf('/') + 1).toLowerCase();
|
|
46
|
-
if (base === 'dockerfile')
|
|
47
|
-
return 'dockerfile';
|
|
48
|
-
if (base === 'makefile')
|
|
49
|
-
return 'makefile';
|
|
50
|
-
return 'text';
|
|
51
|
-
}
|
|
52
|
-
return FENCE_BY_EXT[ext] ?? 'text';
|
|
53
|
-
}
|
|
54
|
-
/** Wrap source text as a fenced block. The fence is grown past the longest
|
|
55
|
-
* backtick run in the content, so a file that itself contains ``` can't close
|
|
56
|
-
* its own block. */
|
|
57
|
-
export function codeFenceDocument(content, language) {
|
|
58
|
-
let longest = 0;
|
|
59
|
-
for (const run of content.matchAll(/`+/g))
|
|
60
|
-
longest = Math.max(longest, run[0].length);
|
|
61
|
-
const fence = '`'.repeat(Math.max(3, longest + 1));
|
|
62
|
-
const body = content.endsWith('\n') ? content.slice(0, -1) : content;
|
|
63
|
-
return `${fence}${language}\n${body}\n${fence}\n`;
|
|
64
|
-
}
|
|
65
|
-
/** Shift a rendered wrapped-document map back onto SOURCE line numbers: the
|
|
66
|
-
* opening fence occupies line 1, so document line N is source line N-1.
|
|
67
|
-
*
|
|
68
|
-
* Rows that touch a fence line are the panel's border/title chrome, not
|
|
69
|
-
* source: they lose BOTH their span and their block row so nothing anchors to
|
|
70
|
-
* them — otherwise the top border would be a step in j/k that selects the
|
|
71
|
-
* whole file. */
|
|
72
|
-
function foldFenceOffset(doc, sourceLineCount) {
|
|
73
|
-
const closingFenceLine = sourceLineCount + 2;
|
|
74
|
-
const clamp = (line) => Math.max(1, Math.min(line - 1, sourceLineCount));
|
|
75
|
-
const chrome = doc.spans.map((span) => span !== null && (span[0] <= 1 || span[1] >= closingFenceLine));
|
|
76
|
-
return {
|
|
77
|
-
lines: doc.lines,
|
|
78
|
-
rows: doc.rows.map((row, index) => (chrome[index] === true ? null : row)),
|
|
79
|
-
spans: doc.spans.map((span, index) => {
|
|
80
|
-
if (span === null || chrome[index] === true)
|
|
81
|
-
return null;
|
|
82
|
-
return [clamp(span[0]), clamp(span[1])];
|
|
83
|
-
}),
|
|
84
|
-
blocks: doc.blocks.map((block) => ({ type: block.type, start: clamp(block.start), end: clamp(block.end) })),
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
/** Render a source file as a syntax-highlighted code panel whose spans are
|
|
88
|
-
* source lines — the code-file counterpart of `renderReviewDoc`. */
|
|
89
|
-
export function codeRenderedDoc(content, language, width) {
|
|
90
|
-
const sourceLineCount = documentLines(content).length;
|
|
91
|
-
return foldFenceOffset(renderMarkdownWithMap(codeFenceDocument(content, language), width), sourceLineCount);
|
|
92
|
-
}
|
|
File without changes
|