gutterpress 0.9.0-alpha.1 → 0.10.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -4
- package/dist/api/index.d.ts +11 -5
- package/dist/api/index.js +20 -15
- package/dist/assets/preview/scripts/preview-bridge.d.ts +1 -0
- package/dist/assets/preview/scripts/preview-interface.d.ts +1 -0
- package/dist/{audit-k16v3n98.js → audit-xxegv0t0.js} +10 -7
- package/dist/{build-8tqr4gbb.js → build-w0vb6mgq.js} +14 -8
- package/dist/checks/source/index.d.ts +1 -0
- package/dist/checks/source/layout-markers.d.ts +3 -0
- package/dist/checks/source/local-ref-parser.d.ts +28 -0
- package/dist/cli-46ycxe6r.js +18 -0
- package/dist/{cli-yp0d2hp8.js → cli-5czby0dd.js} +5351 -5955
- package/dist/cli-c41yr7he.js +241 -0
- package/dist/{cli-rkqxbnkq.js → cli-f4rcbt2t.js} +17 -24
- package/dist/{cli-v2dze8ja.js → cli-gk3wsdpb.js} +69 -253
- package/dist/{index-yzrh708h.js → cli-k1065rkg.js} +2 -5
- package/dist/{cli-506tg37g.js → cli-revgt4pr.js} +2 -1
- package/dist/{cli-wchtvxvw.js → cli-v5mp7a6q.js} +14 -1
- package/dist/cli-yp3p0sf2.js +2343 -0
- package/dist/cli.js +20 -18
- package/dist/{doctor-57czxy3q.js → doctor-ctgn1dnt.js} +4 -2
- package/dist/engine/compiler/build.d.ts +139 -0
- package/dist/engine/compiler/postprocess.d.ts +23 -0
- package/dist/engine/compiler/tier2.d.ts +78 -0
- package/dist/engine/shared/cdp.d.ts +104 -0
- package/dist/engine/shared/content-value.d.ts +64 -0
- package/dist/engine/shared/gcpm-extract.d.ts +119 -0
- package/dist/engine/shared/margin-box-support.d.ts +12 -0
- package/dist/engine/shared/pdf-inspect.d.ts +24 -0
- package/dist/engine/shared/synthesis.d.ts +155 -0
- package/dist/engine-eng4xh2q.js +41 -0
- package/dist/engine-q5skhgms.js +40 -0
- package/dist/gutterpress-agent-1ctgfz92.js +576 -0
- package/dist/gutterpress-viewer-cem7dmr5.js +2349 -0
- package/dist/index-a4kr77td.js +1907 -0
- package/dist/{cli-yzrh708h.js → index-mdefp0y5.js} +1 -1
- package/dist/index-mvehxh0e.js +708 -0
- package/dist/{index-m3pa4wyf.js → index-s416qpdv.js} +3324 -3991
- package/dist/{index-wchtvxvw.js → index-v5mp7a6q.js} +14 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +24 -17
- package/dist/lib/asset-inline.d.ts +36 -0
- package/dist/lib/browser-pool.d.ts +18 -0
- package/dist/lib/build-error.d.ts +1 -1
- package/dist/lib/build-preflight.d.ts +35 -2
- package/dist/lib/build-runner.d.ts +45 -17
- package/dist/lib/build-staging.d.ts +9 -55
- package/dist/lib/cli-args.d.ts +8 -0
- package/dist/lib/desktop.d.ts +2 -2
- package/dist/lib/embedded-assets.d.ts +1 -1
- package/dist/lib/engine.d.ts +33 -0
- package/dist/lib/ghostscript.d.ts +46 -1
- package/dist/lib/markdown/assemble.d.ts +22 -16
- package/dist/lib/markdown/chapter-id.d.ts +1 -1
- package/dist/lib/markdown/gp-pin-scope.d.ts +1 -0
- package/dist/lib/markdown/gutterpress-css.d.ts +125 -0
- package/dist/lib/markdown/images.d.ts +26 -0
- package/dist/lib/markdown/index.d.ts +5 -3
- package/dist/lib/markdown/inline-source.d.ts +10 -0
- package/dist/lib/markdown/markers.d.ts +32 -0
- package/dist/lib/markdown/renderer.d.ts +8 -3
- package/dist/lib/markdown/source-range.d.ts +61 -0
- package/dist/lib/missing-asset-placeholder.d.ts +52 -0
- package/dist/lib/presets.d.ts +1 -1
- package/dist/lib/printsafe.d.ts +2 -3
- package/dist/lib/remote-auth/converge-merge.d.ts +48 -0
- package/dist/lib/remote-auth/image-clash.d.ts +17 -0
- package/dist/lib/remote-auth/recovery/classify.d.ts +55 -67
- package/dist/lib/remote-auth/recovery/inspect.d.ts +14 -13
- package/dist/lib/remote-auth/recovery/locks.d.ts +20 -0
- package/dist/lib/remote-auth/recovery/repair.d.ts +29 -0
- package/dist/lib/remote-auth/recovery/types.d.ts +8 -204
- package/dist/lib/remote-auth/sync-messages.d.ts +2 -3
- package/dist/lib/remote-auth/sync-types.d.ts +35 -63
- package/dist/lib/remote-auth/sync.d.ts +11 -18
- package/dist/lib/remote-auth/transport.d.ts +14 -7
- package/dist/lib/theme-import.d.ts +4 -5
- package/dist/{lint-4sq0dvf6.js → lint-gsh6qwrq.js} +10 -7
- package/dist/{manifest.schema-z61rzw44.json → manifest.schema-zxgxnbg7.json} +21 -0
- package/dist/{new-f2nmyr5b.js → new-nkhycqy4.js} +12 -8
- package/dist/{plugin-xskq3dtx.js → plugin-129wcs93.js} +10 -7
- package/dist/{preflight-epcffags.js → preflight-41hcejg9.js} +10 -7
- package/dist/preview/file-watcher.d.ts +48 -30
- package/dist/preview/http-server.d.ts +5 -2
- package/dist/preview/lifecycle.d.ts +1 -1
- package/dist/preview/server-context.d.ts +2 -0
- package/dist/{pagedjs-bridge-vn4hk9fx.js → preview-bridge-fz7vpk8m.js} +8 -0
- package/dist/preview-interface-fnqb2y4v.js +1015 -0
- package/dist/{preview-xf5dktz2.js → preview-pftsvr9z.js} +16 -9
- package/dist/preview-shell-c5mfa3q0.js +346 -0
- package/dist/{project-source-p0gn1wd5.js → project-source-ekcyp63q.js} +1 -1
- package/dist/{publish-97vdwq31.js → publish-dnjvb4jg.js} +10 -7
- package/dist/render.d.ts +3 -4
- package/dist/render.js +738 -83
- package/dist/{repair-cz4z4hkg.js → repair-a3enjttn.js} +45 -79
- package/dist/schema/manifest.types.d.ts +38 -0
- package/dist/server.d.ts +2 -0
- package/dist/{source-provider-c1rjm2c0.js → source-provider-3tcj6qg2.js} +2 -2
- package/dist/source-provider-vanafrt9.js +40 -0
- package/dist/{theme-zz2ktzqs.css → theme-h5recz6c.css} +8 -7
- package/dist/{theme-570zmh2t.css → theme-j2bagrfx.css} +8 -7
- package/dist/{theme-nya4nqh6.css → theme-nn6d53zy.css} +8 -7
- package/dist/types.d.ts +7 -0
- package/dist/{validate-swzejnd8.js → validate-ph1xffqy.js} +10 -7
- package/package.json +6 -6
- package/dist/cli-yja077f6.js +0 -92
- package/dist/git-http-yrb4ag6z.js +0 -17
- package/dist/index-yja077f6.js +0 -92
- package/dist/lib/markdown/markdown-it-paged.d.ts +0 -30
- package/dist/lib/pagedjs-marker.d.ts +0 -42
- package/dist/lib/pagedjs.d.ts +0 -26
- package/dist/lib/pagination.d.ts +0 -149
- package/dist/lib/remote-auth/conflict-resolution.d.ts +0 -29
- package/dist/lib/remote-auth/recovery/abort-interrupted-operation.d.ts +0 -103
- package/dist/lib/remote-auth/recovery/backup.d.ts +0 -113
- package/dist/lib/remote-auth/recovery/context.d.ts +0 -47
- package/dist/lib/remote-auth/recovery/dispatch.d.ts +0 -28
- package/dist/lib/remote-auth/recovery/failsafe.d.ts +0 -33
- package/dist/lib/remote-auth/recovery/manual-guidance.d.ts +0 -28
- package/dist/lib/remote-auth/recovery/outcome-mapping.d.ts +0 -59
- package/dist/lib/remote-auth/recovery/policy.d.ts +0 -47
- package/dist/lib/remote-auth/recovery/recover-auth.d.ts +0 -42
- package/dist/lib/remote-auth/recovery/recover-binary-conflict.d.ts +0 -37
- package/dist/lib/remote-auth/recovery/recover-corrupt-index.d.ts +0 -40
- package/dist/lib/remote-auth/recovery/recover-detached-head.d.ts +0 -70
- package/dist/lib/remote-auth/recovery/recover-interrupted-cherry-pick.d.ts +0 -23
- package/dist/lib/remote-auth/recovery/recover-interrupted-merge.d.ts +0 -28
- package/dist/lib/remote-auth/recovery/recover-interrupted-rebase.d.ts +0 -39
- package/dist/lib/remote-auth/recovery/recover-merge-conflict.d.ts +0 -34
- package/dist/lib/remote-auth/recovery/recover-missing-git-dir.d.ts +0 -37
- package/dist/lib/remote-auth/recovery/recover-missing-objects.d.ts +0 -56
- package/dist/lib/remote-auth/recovery/recover-network.d.ts +0 -34
- package/dist/lib/remote-auth/recovery/recover-non-fast-forward.d.ts +0 -27
- package/dist/lib/remote-auth/recovery/recover-stale-lock.d.ts +0 -68
- package/dist/lib/remote-auth/recovery/recover-unrelated-histories.d.ts +0 -44
- package/dist/lib/remote-auth/recovery/recover-wrong-remote.d.ts +0 -35
- package/dist/lib/remote-auth/resolution-plan.d.ts +0 -64
- package/dist/paged.polyfill-n95pbxfn.js +0 -33288
- package/dist/pagedjs-interface-80g3xa8p.js +0 -498
- package/dist/preview-shell-rghtfmc8.js +0 -155
- /package/dist/assets/{preview/scripts/pagedjs-bridge.d.ts → engine/gutterpress-agent.d.ts} +0 -0
- /package/dist/assets/{preview/scripts/pagedjs-interface.d.ts → engine/gutterpress-viewer.d.ts} +0 -0
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* recover-network.ts — Offline: keep local work, schedule retry.
|
|
3
|
-
*
|
|
4
|
-
* WHY this module exists: when gutterpress can't reach the server (ECONNREFUSED,
|
|
5
|
-
* ETIMEDOUT, or any other network error), the right behavior is:
|
|
6
|
-
*
|
|
7
|
-
* 1. Snapshot any unsaved work locally so nothing is lost (sync.ts already
|
|
8
|
-
* does this as its first step — "snapshot-first" invariant from ADR 0006 D5).
|
|
9
|
-
* 2. Tell the host to retry later with an exponential backoff delay.
|
|
10
|
-
* 3. Do NOT create a backup zip (risk is "none" — no data is at risk).
|
|
11
|
-
* 4. Do NOT ask the user for confirmation (no repair is being attempted).
|
|
12
|
-
* 5. Do NOT force-push, do NOT touch the remote.
|
|
13
|
-
*
|
|
14
|
-
* This is a THIN WRAPPER around syncProject from sync.ts. The snapshot step,
|
|
15
|
-
* the network call, and the "offline" classification all live there. The only
|
|
16
|
-
* delta this module adds is translating SyncOutcome { status: "offline" } →
|
|
17
|
-
* RecoveryResult { status: "retry_later", retryAfterMs }.
|
|
18
|
-
*
|
|
19
|
-
* Backoff: fixed 30 s delay before the next automated retry.
|
|
20
|
-
*/
|
|
21
|
-
import type { RecoveryContext, RecoveryResult } from "./types.ts";
|
|
22
|
-
/**
|
|
23
|
-
* Handle a `network_unavailable` classification:
|
|
24
|
-
*
|
|
25
|
-
* - Delegates entirely to `syncProject` (which snapshots unsaved work first,
|
|
26
|
-
* then attempts fetch + merge + push through the injectable httpClient).
|
|
27
|
-
* - When the outcome is `offline`, returns `retry_later` with a sane backoff.
|
|
28
|
-
* - When the outcome is anything else (e.g. the network recovered mid-call),
|
|
29
|
-
* passes the outcome through as a `recovered` result so the host can refresh.
|
|
30
|
-
*
|
|
31
|
-
* The `error` argument is accepted per the dispatcher contract but is not
|
|
32
|
-
* needed here: syncProject already re-classifies the live error internally.
|
|
33
|
-
*/
|
|
34
|
-
export declare function recover(ctx: RecoveryContext, _error?: unknown): Promise<RecoveryResult>;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* recover-non-fast-forward.ts — thin wrapper over syncProject.
|
|
3
|
-
*
|
|
4
|
-
* WHY this exists: when a push is rejected because the online copy has commits
|
|
5
|
-
* this computer doesn't have, the correct fix is pull-then-push — which is
|
|
6
|
-
* exactly what syncProject already does. This handler just calls syncProject
|
|
7
|
-
* and maps its typed SyncOutcome to the RecoveryResult contract.
|
|
8
|
-
*
|
|
9
|
-
* NO backup is created (policy.createBackup = false for non_fast_forward):
|
|
10
|
-
* syncProject takes its own snapshot before touching anything (ADR 0006 D5),
|
|
11
|
-
* so the user's work is safe without an additional zip.
|
|
12
|
-
*
|
|
13
|
-
* NO force-push is ever used: syncProject/pullChanges/pushChanges use only
|
|
14
|
-
* the normal git.push(), which the server rejects when a force-push would be
|
|
15
|
-
* needed. The safety invariant is proved by gitSpy in the test.
|
|
16
|
-
*
|
|
17
|
-
* Outcome mapping:
|
|
18
|
-
* SyncOutcome.status → RecoveryResult.status
|
|
19
|
-
* 'synced' → 'recovered'
|
|
20
|
-
* 'up-to-date' → 'recovered' (local commits all landed; nothing new)
|
|
21
|
-
* 'conflict' → 'needs_user' (let the user choose per file)
|
|
22
|
-
* 'auth' → 'needs_user' (guidance: reconnect)
|
|
23
|
-
* 'offline' → 'retry_later'
|
|
24
|
-
* 'error' → 'failed_no_changes_made'
|
|
25
|
-
*/
|
|
26
|
-
import type { RecoverFn } from "./types.ts";
|
|
27
|
-
export declare const recover: RecoverFn;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* recover-stale-lock.ts — remove stale .git lock files left by a crash.
|
|
3
|
-
*
|
|
4
|
-
* WHY: When a write operation is interrupted (power loss, forced kill, crash)
|
|
5
|
-
* the version-tracking system leaves a lock file behind. Every subsequent
|
|
6
|
-
* operation fails until the lock is removed. This handler automates that
|
|
7
|
-
* cleanup with a conservative age check and a user confirmation gate.
|
|
8
|
-
*
|
|
9
|
-
* A crash does NOT only leave `.git/index.lock`. Depending on what was being
|
|
10
|
-
* written when the process died, git can leave any of:
|
|
11
|
-
* - index.lock (staging the index)
|
|
12
|
-
* - HEAD.lock (moving HEAD)
|
|
13
|
-
* - config.lock (writing config)
|
|
14
|
-
* - packed-refs.lock (repacking refs)
|
|
15
|
-
* - refs/**\/<name>.lock (updating a single ref, e.g. refs/heads/main.lock)
|
|
16
|
-
* If the stuck lock is any of these and we only ever looked at index.lock, the
|
|
17
|
-
* repo would stay unusable forever. So this handler scans the known top-level
|
|
18
|
-
* lock files PLUS a shallow scan of `.git/refs/**` for `*.lock` files.
|
|
19
|
-
*
|
|
20
|
-
* Decision logic (applied to the WHOLE candidate set, not just index.lock):
|
|
21
|
-
* NO lock at all → the race was already won; return retry_later (safe to
|
|
22
|
-
* retry the original operation immediately).
|
|
23
|
-
* ANY lock is FRESH (age < STALE_THRESHOLD_MS) → a live process may still
|
|
24
|
-
* hold the repo. Deleting a lock another process holds would corrupt an
|
|
25
|
-
* in-flight write, so we delete NOTHING and return retry_later — even if
|
|
26
|
-
* other locks in the set are stale. One fresh lock blocks the whole sweep.
|
|
27
|
-
* ALL locks are STALE (age ≥ STALE_THRESHOLD_MS) → request user confirmation
|
|
28
|
-
* once, then remove every stale lock; return recovered.
|
|
29
|
-
*
|
|
30
|
-
* Why "any fresh → retry_later" (and not "remove the stale ones"): the locks
|
|
31
|
-
* in the set may belong to the SAME interrupted-or-live operation. We cannot
|
|
32
|
-
* tell a crashed lock from a live one except by age, so the safe rule is: if
|
|
33
|
-
* the youngest lock could still be held, leave them all alone for now.
|
|
34
|
-
*
|
|
35
|
-
* Safety invariants:
|
|
36
|
-
* - Never force-pushes (this repair is entirely local).
|
|
37
|
-
* - No backup zip (policy.createBackup = false for stale_lock; a lock file
|
|
38
|
-
* is trivially recreatable and contains no user data).
|
|
39
|
-
* - Confirmation required (policy.requireConfirmation = true).
|
|
40
|
-
* - Fault hook ctx.faults?.before("remove_index_lock") fires once, just
|
|
41
|
-
* before the FIRST unlink, so tests can assert the fail-safe path. If it
|
|
42
|
-
* throws, nothing is removed.
|
|
43
|
-
* - Only locks proven stale are removed; a fresh lock is never touched.
|
|
44
|
-
* - User content files are never touched.
|
|
45
|
-
*
|
|
46
|
-
* Author-facing copy lives in manual-guidance.ts (stale_lock case). No git
|
|
47
|
-
* words, no file paths, no tokens in any user-visible string — the copy here
|
|
48
|
-
* says "leftover lock" / "temporary lock", never "lock file"/"index"/"ref".
|
|
49
|
-
*/
|
|
50
|
-
import type { RecoveryContext, RecoveryResult } from "./types.ts";
|
|
51
|
-
export interface LockCandidate {
|
|
52
|
-
/** Absolute path to the lock file. */
|
|
53
|
-
path: string;
|
|
54
|
-
/** Age in ms relative to `now` (now - mtime). */
|
|
55
|
-
ageMs: number;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Gather every candidate lock file (top-level + refs/**) with its age.
|
|
59
|
-
* Locks that vanish between discovery and stat are simply dropped (a racing
|
|
60
|
-
* delete is fine to ignore). Never throws.
|
|
61
|
-
*/
|
|
62
|
-
export declare function findLockCandidates(gitDir: string, now: number): Promise<LockCandidate[]>;
|
|
63
|
-
/**
|
|
64
|
-
* Attempt to recover from stale .git lock files (index.lock and friends).
|
|
65
|
-
*
|
|
66
|
-
* Implements the RecoverFn contract from types.ts.
|
|
67
|
-
*/
|
|
68
|
-
export declare function recover(ctx: RecoveryContext, _error?: unknown): Promise<RecoveryResult>;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* recover-unrelated-histories.ts — Combine local and remote when they share
|
|
3
|
-
* no history.
|
|
4
|
-
*
|
|
5
|
-
* WHY this is needed:
|
|
6
|
-
* If a user's local project and the configured online project were created
|
|
7
|
-
* independently — with no shared starting point — a normal merge cannot
|
|
8
|
-
* combine them. This handler creates a backup, asks the user to confirm,
|
|
9
|
-
* then performs the combination locally:
|
|
10
|
-
*
|
|
11
|
-
* 1. Fetches the remote tip.
|
|
12
|
-
* 2. Merges the remote into the local branch with
|
|
13
|
-
* `allowUnrelatedHistories: true`.
|
|
14
|
-
* 3. On clean merge → combined successfully.
|
|
15
|
-
* 4. On file conflicts → surfaces `needs_user` with the conflict file list
|
|
16
|
-
* and the local/remote OIDs, so the host can show the per-file version
|
|
17
|
-
* chooser and call `resolveConflicts({ allowUnrelatedHistories: true })`
|
|
18
|
-
* with the user's choices ("keep mine", "keep theirs", "keep both").
|
|
19
|
-
*
|
|
20
|
-
* The per-file resolution (merge driver, binary safety, "keep both" →
|
|
21
|
-
* "(online copy)" rename, delete-conflict equalization, push) is handled
|
|
22
|
-
* entirely by `sync.ts:resolveConflicts` — this handler just sets up the
|
|
23
|
-
* merge and surfaces the conflict, exactly like `recover-merge-conflict.ts`
|
|
24
|
-
* and `recover-binary-conflict.ts`.
|
|
25
|
-
*
|
|
26
|
-
* Safety invariants:
|
|
27
|
-
* - NEVER pushes to the remote (mayChangeRemote:false in policy). The push
|
|
28
|
-
* happens later in `resolveConflicts` AFTER the user makes their choices.
|
|
29
|
-
* - Remote is fetched but never written to.
|
|
30
|
-
* - Backup zip created and verified BEFORE any repair.
|
|
31
|
-
* - backup_create fault → failed_no_changes_made, no further writes.
|
|
32
|
-
* - mid-repair fault → failed_backup_available, backup readable.
|
|
33
|
-
* - User DENY → blocked, local + remote unchanged, backup still readable.
|
|
34
|
-
* - No remoteUrl → blocked with guidance.
|
|
35
|
-
* - Merge conflict → branch unchanged (abortOnConflict:true is the default);
|
|
36
|
-
* local commits preserved on the branch and in the backup zip. The
|
|
37
|
-
* conflict file list + OIDs are threaded through so the host can call
|
|
38
|
-
* `resolveConflicts` after the user decides.
|
|
39
|
-
*
|
|
40
|
-
* Fault injection points:
|
|
41
|
-
* after_backup_before_repair, fetch, merge
|
|
42
|
-
*/
|
|
43
|
-
import type { RecoverFn } from "./types.ts";
|
|
44
|
-
export declare const recover: RecoverFn;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* recover-wrong-remote.ts — Wrong remote / missing destination.
|
|
3
|
-
*
|
|
4
|
-
* WHAT: When the project's configured online destination is unreachable,
|
|
5
|
-
* returns 404, or the destination section (path) does not exist on the
|
|
6
|
-
* server, syncing cannot proceed. This handler:
|
|
7
|
-
* 1. Uses diagnoseProjectRemote + parseRemoteOrigin (CLAUDE.md §7 mandated
|
|
8
|
-
* reuses) to obtain the project's remote URL, host, and protocol facts.
|
|
9
|
-
* 2. Probes the remote using isomorphic-git listServerRefs via httpClient
|
|
10
|
-
* (no system git binary) to detect whether the configured destination
|
|
11
|
-
* is actually present on the server.
|
|
12
|
-
* 3. Returns status "blocked" with reconnect/choose-destination guidance.
|
|
13
|
-
* The supportDetails reflect whether the destination was found or absent,
|
|
14
|
-
* so the guidance can distinguish "destination missing" from "wrong address".
|
|
15
|
-
* 4. NEVER creates a destination on the server automatically.
|
|
16
|
-
* 5. NEVER pushes to the remote.
|
|
17
|
-
* 6. Leaves all local files and remote state completely unchanged.
|
|
18
|
-
*
|
|
19
|
-
* Policy: createBackup:false — pure block, no repair attempted.
|
|
20
|
-
* requireConfirmation:false — confirmation gate is never called.
|
|
21
|
-
*
|
|
22
|
-
* WHY this is always "blocked": the handler is invoked ONLY after the
|
|
23
|
-
* classifier has determined the remote or destination is wrong. There is no
|
|
24
|
-
* safe automated fix — the author must update the project settings.
|
|
25
|
-
*/
|
|
26
|
-
import type { RecoverFn } from "./types.ts";
|
|
27
|
-
/**
|
|
28
|
-
* Block sync and return author-facing reconnect guidance.
|
|
29
|
-
* Never pushes, never modifies local files or remote state.
|
|
30
|
-
*
|
|
31
|
-
* Uses diagnoseProjectRemote to get remote/protocol facts, and
|
|
32
|
-
* listServerRefs to detect whether the configured destination exists
|
|
33
|
-
* on the server — all read-only operations.
|
|
34
|
-
*/
|
|
35
|
-
export declare const recover: RecoverFn;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pure per-file resolution PLAN builder for {@link resolveConflicts} (#15,
|
|
3
|
-
* ADR 0006 D5). Given the author's per-file choices and the two commit tips,
|
|
4
|
-
* it decides — for EACH conflicted file — what the merge driver should return
|
|
5
|
-
* ("mine"/"theirs"), what to write/delete on the LOCAL side before the merge
|
|
6
|
-
* (delete-conflict equalization + "(online copy)" files), what to restore
|
|
7
|
-
* after the merge, and which decided files need a raw-bytes binary fix.
|
|
8
|
-
*
|
|
9
|
-
* It is intentionally free of git/fs coupling: the only IO it needs — reading
|
|
10
|
-
* a file's blob from a commit, and picking a collision-free "(online copy)"
|
|
11
|
-
* name — is injected via {@link ResolutionPlanDeps}, so the whole decision
|
|
12
|
-
* table is unit-testable with plain fakes. sync.ts owns the git side-effects
|
|
13
|
-
* of ACTUALLY writing/deleting/merging/pushing; this module owns only the
|
|
14
|
-
* decisions.
|
|
15
|
-
*/
|
|
16
|
-
/** Author's per-file decision for a conflicted file (mirror of sync.ts). */
|
|
17
|
-
export interface ResolutionInput {
|
|
18
|
-
path: string;
|
|
19
|
-
choice: "mine" | "theirs" | "both";
|
|
20
|
-
}
|
|
21
|
-
/** A file to write with exact bytes (never decoded through a string). */
|
|
22
|
-
export interface PlanWrite {
|
|
23
|
-
path: string;
|
|
24
|
-
content: Uint8Array;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* The decisions {@link resolveConflicts} executes, in order:
|
|
28
|
-
*
|
|
29
|
-
* - `driverChoice` — the side the custom mergeDriver returns per decided file.
|
|
30
|
-
* - `preWrites` / `preDeletes` — applied on the LOCAL side BEFORE the merge
|
|
31
|
-
* ("(online copy)" files + delete-conflict equalization) so the merge is
|
|
32
|
-
* clean and both parents stay honest.
|
|
33
|
-
* - `postWrites` / `postDeletes` — applied AFTER the merge to restore the
|
|
34
|
-
* author's chosen side for delete-involved files equalized the other way.
|
|
35
|
-
* - `postBinaryFixes` — decided files overwritten with raw git-object bytes
|
|
36
|
-
* after checkout, guarding against UTF-8 round-trip corruption of binaries
|
|
37
|
-
* in the string-based merge driver (a no-op for text files).
|
|
38
|
-
*/
|
|
39
|
-
export interface ResolutionPlan {
|
|
40
|
-
driverChoice: Map<string, "mine" | "theirs">;
|
|
41
|
-
preWrites: PlanWrite[];
|
|
42
|
-
preDeletes: string[];
|
|
43
|
-
postWrites: PlanWrite[];
|
|
44
|
-
postDeletes: string[];
|
|
45
|
-
postBinaryFixes: PlanWrite[];
|
|
46
|
-
}
|
|
47
|
-
/** Injected IO the plan builder needs (kept out of this pure module). */
|
|
48
|
-
export interface ResolutionPlanDeps {
|
|
49
|
-
/** Read a file's blob from a commit oid, or null when absent in that tree. */
|
|
50
|
-
readBlob: (oid: string, filepath: string) => Promise<Uint8Array | null>;
|
|
51
|
-
/**
|
|
52
|
-
* First "(online copy)" name for `filepath` that collides with nothing in
|
|
53
|
-
* the working dir or in either side's tree (given by `oids`).
|
|
54
|
-
*/
|
|
55
|
-
uniqueOnlineCopyPath: (filepath: string, oids: string[]) => Promise<string>;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Build the per-file plan. "mine" is read from `localTip` (the CURRENT local
|
|
59
|
-
* tip, so edits made after the conflict was reported count as the author's
|
|
60
|
-
* version); "theirs" is read from `remoteId` (the online tip). Files present
|
|
61
|
-
* on BOTH sides are settled inside the merge by the driver; delete-involved
|
|
62
|
-
* files are equalized before the merge and restored after.
|
|
63
|
-
*/
|
|
64
|
-
export declare function buildResolutionPlan(resolutions: ResolutionInput[], localTip: string, remoteId: string, deps: ResolutionPlanDeps): Promise<ResolutionPlan>;
|