@amalgm/shell 0.1.164-main.40070365614 → 0.1.164-main.40795482467
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/accepted-fold.d.ts +24 -46
- package/dist/accepted-fold.js +62 -140
- package/dist/accepted-fold.js.map +1 -1
- package/dist/accepted-tail.d.ts +3 -3
- package/dist/accepted-tail.js +6 -6
- package/dist/accepted-tail.js.map +1 -1
- package/dist/apply-control.d.ts +9 -4
- package/dist/apply-control.js +18 -5
- package/dist/apply-control.js.map +1 -1
- package/dist/apply-enter-build.d.ts +6 -7
- package/dist/apply-enter-build.js +4 -10
- package/dist/apply-enter-build.js.map +1 -1
- package/dist/apply-enter-plan.d.ts +9 -7
- package/dist/apply-enter-plan.js +40 -27
- package/dist/apply-enter-plan.js.map +1 -1
- package/dist/apply-local-work.d.ts +8 -20
- package/dist/apply-local-work.js +18 -95
- package/dist/apply-local-work.js.map +1 -1
- package/dist/apply-showing.d.ts +15 -1
- package/dist/apply-showing.js +26 -4
- package/dist/apply-showing.js.map +1 -1
- package/dist/apply-window-ground.d.ts +7 -9
- package/dist/apply-window-ground.js +16 -11
- package/dist/apply-window-ground.js.map +1 -1
- package/dist/apply-window-host.d.ts +29 -4
- package/dist/apply-window-host.js +212 -280
- package/dist/apply-window-host.js.map +1 -1
- package/dist/apply-window-line.d.ts +2 -1
- package/dist/apply-window-line.js +5 -4
- package/dist/apply-window-line.js.map +1 -1
- package/dist/apply-window-recovery.js +18 -30
- package/dist/apply-window-recovery.js.map +1 -1
- package/dist/apply-window-reveal.d.ts +0 -7
- package/dist/apply-window-reveal.js +5 -48
- package/dist/apply-window-reveal.js.map +1 -1
- package/dist/apply-window-rows.d.ts +1 -24
- package/dist/apply-window-rows.js.map +1 -1
- package/dist/apply-window-saves.d.ts +16 -9
- package/dist/apply-window-saves.js +65 -19
- package/dist/apply-window-saves.js.map +1 -1
- package/dist/apply-window-store.d.ts +6 -6
- package/dist/apply-window-store.js +7 -4
- package/dist/apply-window-store.js.map +1 -1
- package/dist/apply-window-verify.d.ts +4 -7
- package/dist/apply-window-verify.js +4 -23
- package/dist/apply-window-verify.js.map +1 -1
- package/dist/baseline-content.d.ts +3 -5
- package/dist/baseline-content.js +7 -44
- package/dist/baseline-content.js.map +1 -1
- package/dist/content-cache-retention.d.ts +3 -2
- package/dist/content-cache-retention.js +11 -11
- package/dist/content-cache-retention.js.map +1 -1
- package/dist/content-capture-pool.d.ts +4 -47
- package/dist/content-capture-pool.js +3 -42
- package/dist/content-capture-pool.js.map +1 -1
- package/dist/content-capture-worker.d.ts +2 -3
- package/dist/content-capture-worker.js +2 -19
- package/dist/content-capture-worker.js.map +1 -1
- package/dist/declaration-absorption.d.ts +9 -15
- package/dist/declaration-absorption.js +14 -32
- package/dist/declaration-absorption.js.map +1 -1
- package/dist/declaration-commit.d.ts +0 -5
- package/dist/declaration-commit.js +1 -6
- package/dist/declaration-commit.js.map +1 -1
- package/dist/declaration-save.d.ts +0 -4
- package/dist/declaration-save.js +0 -4
- package/dist/declaration-save.js.map +1 -1
- package/dist/detection/accepted-result.js +1 -1
- package/dist/detection/accepted-result.js.map +1 -1
- package/dist/detection/admission-save.d.ts +7 -17
- package/dist/detection/admission-save.js +4 -11
- package/dist/detection/admission-save.js.map +1 -1
- package/dist/detection/admission-units.d.ts +10 -26
- package/dist/detection/admission-units.js +12 -50
- package/dist/detection/admission-units.js.map +1 -1
- package/dist/detection/apply-ownership.d.ts +2 -2
- package/dist/detection/apply-ownership.js +2 -7
- package/dist/detection/apply-ownership.js.map +1 -1
- package/dist/detection/capture-outcome.js +12 -19
- package/dist/detection/capture-outcome.js.map +1 -1
- package/dist/detection/dispositions.d.ts +1 -1
- package/dist/detection/dispositions.js +3 -4
- package/dist/detection/dispositions.js.map +1 -1
- package/dist/detection/ground-proof.d.ts +1 -3
- package/dist/detection/ground-proof.js +0 -9
- package/dist/detection/ground-proof.js.map +1 -1
- package/dist/detection/ground-reader.d.ts +1 -5
- package/dist/detection/ground-reader.js +1 -31
- package/dist/detection/ground-reader.js.map +1 -1
- package/dist/detection/notebook-basis.d.ts +1 -2
- package/dist/detection/notebook-basis.js +2 -4
- package/dist/detection/notebook-basis.js.map +1 -1
- package/dist/detection/owed-selection.d.ts +2 -3
- package/dist/detection/owed-selection.js +3 -6
- package/dist/detection/owed-selection.js.map +1 -1
- package/dist/detection/portable.d.ts +7 -48
- package/dist/detection/portable.js +46 -155
- package/dist/detection/portable.js.map +1 -1
- package/dist/detection/repository-state.d.ts +35 -0
- package/dist/detection/repository-state.js +51 -0
- package/dist/detection/repository-state.js.map +1 -0
- package/dist/detection/root-examination.d.ts +1 -11
- package/dist/detection/root-examination.js +69 -127
- package/dist/detection/root-examination.js.map +1 -1
- package/dist/detection/runtime.d.ts +8 -32
- package/dist/detection/runtime.js +36 -140
- package/dist/detection/runtime.js.map +1 -1
- package/dist/detection/scope-frame.d.ts +32 -62
- package/dist/detection/scope-frame.js +139 -214
- package/dist/detection/scope-frame.js.map +1 -1
- package/dist/detection/scoped-identity-port.d.ts +1 -1
- package/dist/detection/scoped-identity-port.js +3 -4
- package/dist/detection/scoped-identity-port.js.map +1 -1
- package/dist/detection/walk-law.d.ts +3 -11
- package/dist/detection/walk-law.js +5 -9
- package/dist/detection/walk-law.js.map +1 -1
- package/dist/git/ground-owners.d.ts +8 -0
- package/dist/git/ground-owners.js +25 -0
- package/dist/git/ground-owners.js.map +1 -0
- package/dist/git/home.d.ts +39 -0
- package/dist/git/home.js +81 -0
- package/dist/git/home.js.map +1 -0
- package/dist/git/marker.d.ts +21 -0
- package/dist/git/marker.js +30 -0
- package/dist/git/marker.js.map +1 -0
- package/dist/git/objects.d.ts +42 -0
- package/dist/git/objects.js +144 -0
- package/dist/git/objects.js.map +1 -0
- package/dist/git/rail.d.ts +90 -0
- package/dist/git/rail.js +341 -0
- package/dist/git/rail.js.map +1 -0
- package/dist/git/read-state.d.ts +21 -0
- package/dist/git/read-state.js +143 -0
- package/dist/git/read-state.js.map +1 -0
- package/dist/git/repository.d.ts +48 -0
- package/dist/git/repository.js +110 -0
- package/dist/git/repository.js.map +1 -0
- package/dist/git/write-files.d.ts +9 -0
- package/dist/git/write-files.js +125 -0
- package/dist/git/write-files.js.map +1 -0
- package/dist/git-binding.d.ts +0 -53
- package/dist/git-binding.js +3 -114
- package/dist/git-binding.js.map +1 -1
- package/dist/git-command.js +11 -2
- package/dist/git-command.js.map +1 -1
- package/dist/git-index-entries.d.ts +7 -15
- package/dist/git-index-entries.js +3 -41
- package/dist/git-index-entries.js.map +1 -1
- package/dist/git-index-format.d.ts +4 -7
- package/dist/git-index-format.js +41 -106
- package/dist/git-index-format.js.map +1 -1
- package/dist/graph-publication.d.ts +6 -7
- package/dist/graph-publication.js +9 -21
- package/dist/graph-publication.js.map +1 -1
- package/dist/ground-basis.d.ts +1 -37
- package/dist/ground-basis.js +5 -162
- package/dist/ground-basis.js.map +1 -1
- package/dist/ground-database.js +0 -22
- package/dist/ground-database.js.map +1 -1
- package/dist/ground-install-saves.d.ts +0 -4
- package/dist/ground-install-saves.js +0 -4
- package/dist/ground-install-saves.js.map +1 -1
- package/dist/ground-inventory-schema.js +0 -3
- package/dist/ground-inventory-schema.js.map +1 -1
- package/dist/ground-marks.d.ts +7 -33
- package/dist/ground-marks.js +8 -55
- package/dist/ground-marks.js.map +1 -1
- package/dist/ground-relations.d.ts +2 -2
- package/dist/ground-relations.js +5 -10
- package/dist/ground-relations.js.map +1 -1
- package/dist/ground-row.d.ts +0 -7
- package/dist/ground-row.js +7 -12
- package/dist/ground-row.js.map +1 -1
- package/dist/ground-save-ops.d.ts +2 -1
- package/dist/ground-save-ops.js +2 -1
- package/dist/ground-save-ops.js.map +1 -1
- package/dist/ground-store.d.ts +0 -10
- package/dist/ground-store.js +19 -131
- package/dist/ground-store.js.map +1 -1
- package/dist/materialize-records.d.ts +19 -20
- package/dist/materialize-records.js +123 -244
- package/dist/materialize-records.js.map +1 -1
- package/dist/materialized-graph.d.ts +3 -22
- package/dist/materialized-graph.js +1 -142
- package/dist/materialized-graph.js.map +1 -1
- package/dist/received-state.d.ts +4 -6
- package/dist/received-state.js +6 -11
- package/dist/received-state.js.map +1 -1
- package/dist/root-install.d.ts +1 -2
- package/dist/root-install.js +2 -11
- package/dist/root-install.js.map +1 -1
- package/dist/sharing-admission.d.ts +1 -2
- package/dist/sharing-admission.js +8 -77
- package/dist/sharing-admission.js.map +1 -1
- package/dist/source-witness.d.ts +1 -7
- package/dist/source-witness.js +0 -12
- package/dist/source-witness.js.map +1 -1
- package/dist/user-ground-host.d.ts +21 -35
- package/dist/user-ground-host.js +423 -1484
- package/dist/user-ground-host.js.map +1 -1
- package/npm-shrinkwrap.json +24 -24
- package/package.json +5 -5
- package/dist/apply-window-repository.d.ts +0 -97
- package/dist/apply-window-repository.js +0 -464
- package/dist/apply-window-repository.js.map +0 -1
- package/dist/detection/codec-standing.d.ts +0 -27
- package/dist/detection/codec-standing.js +0 -86
- package/dist/detection/codec-standing.js.map +0 -1
- package/dist/detection/git-notice.d.ts +0 -104
- package/dist/detection/git-notice.js +0 -483
- package/dist/detection/git-notice.js.map +0 -1
- package/dist/detection/held-survey.d.ts +0 -39
- package/dist/detection/held-survey.js +0 -105
- package/dist/detection/held-survey.js.map +0 -1
- package/dist/detection/held-territory.d.ts +0 -73
- package/dist/detection/held-territory.js +0 -266
- package/dist/detection/held-territory.js.map +0 -1
- package/dist/detection/name-reach.d.ts +0 -12
- package/dist/detection/name-reach.js +0 -28
- package/dist/detection/name-reach.js.map +0 -1
- package/dist/detection/own-channel.d.ts +0 -17
- package/dist/detection/own-channel.js +0 -31
- package/dist/detection/own-channel.js.map +0 -1
- package/dist/detection/repository-publication.d.ts +0 -22
- package/dist/detection/repository-publication.js +0 -81
- package/dist/detection/repository-publication.js.map +0 -1
- package/dist/detection/repository-routes.d.ts +0 -50
- package/dist/detection/repository-routes.js +0 -118
- package/dist/detection/repository-routes.js.map +0 -1
- package/dist/detection/repository-seals.d.ts +0 -98
- package/dist/detection/repository-seals.js +0 -145
- package/dist/detection/repository-seals.js.map +0 -1
- package/dist/detection/seal-law.d.ts +0 -59
- package/dist/detection/seal-law.js +0 -103
- package/dist/detection/seal-law.js.map +0 -1
- package/dist/git-capture.d.ts +0 -47
- package/dist/git-capture.js +0 -153
- package/dist/git-capture.js.map +0 -1
- package/dist/git-card.d.ts +0 -30
- package/dist/git-card.js +0 -136
- package/dist/git-card.js.map +0 -1
- package/dist/git-checkpoint-construction.d.ts +0 -54
- package/dist/git-checkpoint-construction.js +0 -126
- package/dist/git-checkpoint-construction.js.map +0 -1
- package/dist/git-checkpoint-preparation.d.ts +0 -47
- package/dist/git-checkpoint-preparation.js +0 -201
- package/dist/git-checkpoint-preparation.js.map +0 -1
- package/dist/git-configuration.d.ts +0 -53
- package/dist/git-configuration.js +0 -238
- package/dist/git-configuration.js.map +0 -1
- package/dist/git-evidence.d.ts +0 -50
- package/dist/git-evidence.js +0 -114
- package/dist/git-evidence.js.map +0 -1
- package/dist/git-facts.d.ts +0 -2
- package/dist/git-facts.js +0 -35
- package/dist/git-facts.js.map +0 -1
- package/dist/git-index-witness.d.ts +0 -34
- package/dist/git-index-witness.js +0 -85
- package/dist/git-index-witness.js.map +0 -1
- package/dist/git-literal-batch.d.ts +0 -82
- package/dist/git-literal-batch.js +0 -152
- package/dist/git-literal-batch.js.map +0 -1
- package/dist/git-literal-host.d.ts +0 -76
- package/dist/git-literal-host.js +0 -185
- package/dist/git-literal-host.js.map +0 -1
- package/dist/git-literal-read.d.ts +0 -74
- package/dist/git-literal-read.js +0 -186
- package/dist/git-literal-read.js.map +0 -1
- package/dist/git-literal-replay.d.ts +0 -83
- package/dist/git-literal-replay.js +0 -393
- package/dist/git-literal-replay.js.map +0 -1
- package/dist/git-native-file.d.ts +0 -42
- package/dist/git-native-file.js +0 -145
- package/dist/git-native-file.js.map +0 -1
- package/dist/git-native-index.d.ts +0 -27
- package/dist/git-native-index.js +0 -44
- package/dist/git-native-index.js.map +0 -1
- package/dist/git-operation-host.d.ts +0 -42
- package/dist/git-operation-host.js +0 -115
- package/dist/git-operation-host.js.map +0 -1
- package/dist/git-private-repository.d.ts +0 -4
- package/dist/git-private-repository.js +0 -66
- package/dist/git-private-repository.js.map +0 -1
- package/dist/git-private-view.d.ts +0 -72
- package/dist/git-private-view.js +0 -318
- package/dist/git-private-view.js.map +0 -1
- package/dist/git-records.d.ts +0 -29
- package/dist/git-records.js +0 -119
- package/dist/git-records.js.map +0 -1
- package/dist/git-ref-store.d.ts +0 -12
- package/dist/git-ref-store.js +0 -68
- package/dist/git-ref-store.js.map +0 -1
- package/dist/git-registration-host.d.ts +0 -42
- package/dist/git-registration-host.js +0 -98
- package/dist/git-registration-host.js.map +0 -1
- package/dist/git-repository-host.d.ts +0 -291
- package/dist/git-repository-host.js +0 -1291
- package/dist/git-repository-host.js.map +0 -1
- package/dist/git-spelling.d.ts +0 -41
- package/dist/git-spelling.js +0 -233
- package/dist/git-spelling.js.map +0 -1
- package/dist/git-tree-objects.d.ts +0 -22
- package/dist/git-tree-objects.js +0 -205
- package/dist/git-tree-objects.js.map +0 -1
- package/dist/git-worktree-host.d.ts +0 -2
- package/dist/git-worktree-host.js +0 -16
- package/dist/git-worktree-host.js.map +0 -1
- package/dist/ground-territory.d.ts +0 -106
- package/dist/ground-territory.js +0 -340
- package/dist/ground-territory.js.map +0 -1
- package/dist/repository-checkpoint-file.d.ts +0 -20
- package/dist/repository-checkpoint-file.js +0 -129
- package/dist/repository-checkpoint-file.js.map +0 -1
- package/dist/repository-statement.d.ts +0 -21
- package/dist/repository-statement.js +0 -33
- package/dist/repository-statement.js.map +0 -1
- package/dist/reveal-owner.d.ts +0 -16
- package/dist/reveal-owner.js +0 -74
- package/dist/reveal-owner.js.map +0 -1
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
/** One repository seal law for every examination, on whichever thread
|
|
2
|
-
* examines: whether this Git state and these owned leaves derive O's
|
|
3
|
-
* repository row exactly as sealed. The reason is evidence, never a
|
|
4
|
-
* different answer. */
|
|
5
|
-
import { createHash } from "node:crypto";
|
|
6
|
-
import { finishSteps, ITEMS_PER_BOUNDARY, portableFileMode, repositoryIdentityHashSteps, } from "@amalgm/live";
|
|
7
|
-
import { sealRefused } from "../git-evidence.js";
|
|
8
|
-
import { createSha256 } from "../sha256.js";
|
|
9
|
-
import { eachInTurns, finishStepsInTurns } from "../turns.js";
|
|
10
|
-
/** The text a selection key hashes, one member at a time in path order:
|
|
11
|
-
* `["repository-selection@1", [path, uuid, type, payloadVersion, fileMode, source], ...]`. */
|
|
12
|
-
function* selectionText(members) {
|
|
13
|
-
yield `[${JSON.stringify("repository-selection@1")}`;
|
|
14
|
-
for (const member of [...members].sort((left, right) => left.path < right.path ? -1 : left.path > right.path ? 1 : 0)) {
|
|
15
|
-
yield `,${JSON.stringify([member.path, member.uuid, member.type, member.payloadVersion, member.fileMode, member.source])}`;
|
|
16
|
-
}
|
|
17
|
-
yield "]";
|
|
18
|
-
}
|
|
19
|
-
/** The exact selected member set one repository result derives from,
|
|
20
|
-
* hashed a bounded run of members per turn. */
|
|
21
|
-
export async function repositorySelectionKeyInTurns(members) {
|
|
22
|
-
const hash = createHash("sha256");
|
|
23
|
-
await eachInTurns(selectionText(members), text => hash.update(text));
|
|
24
|
-
return hash.digest("hex");
|
|
25
|
-
}
|
|
26
|
-
/** Null when the seal stands. `prior` is O by address in the walk's frame.
|
|
27
|
-
* A nested repository enters only as its boundary: the enclosing Checkpoint takes a gitlink from
|
|
28
|
-
* its own index and never reads the nested state, so a nested payload is
|
|
29
|
-
* never an input here. `git` is null for a repository no Watch name reached,
|
|
30
|
-
* its Git storage included: the Git state it was sealed under stands, and
|
|
31
|
-
* only the owned entries are compared.
|
|
32
|
-
*
|
|
33
|
-
* Held, a seal whose members were O's at the members revision this
|
|
34
|
-
* examination read needs no hash: when the walked entries are exactly the
|
|
35
|
-
* examined rows, unchanged, the members are O's, and O's are the sealed. */
|
|
36
|
-
export const sealMiss = (question) => finishSteps(sealMissSteps(question));
|
|
37
|
-
/** The same judgment on the main thread, a bounded run of owned entries per turn. */
|
|
38
|
-
export const sealMissInTurns = (question) => finishStepsInTurns(sealMissSteps(question));
|
|
39
|
-
function* sealMissSteps(question) {
|
|
40
|
-
const { repository, owned, held, git, sealed, prior } = question;
|
|
41
|
-
if (git !== null && sealRefused(git))
|
|
42
|
-
return git.refused;
|
|
43
|
-
const priorRow = prior(repository.relativePath);
|
|
44
|
-
if (priorRow?.type !== "repo.git" || !priorRow.payloadVersion || !priorRow.gitConfigurationObservation)
|
|
45
|
-
return "no-prior";
|
|
46
|
-
if (sealed === null)
|
|
47
|
-
return "no-seal";
|
|
48
|
-
if (sealed.observedPayload !== priorRow.payloadVersion)
|
|
49
|
-
return "stale-seal";
|
|
50
|
-
if (git !== null && sealed.fingerprint !== git.fingerprint)
|
|
51
|
-
return "git-changed";
|
|
52
|
-
if (git !== null && git.configuration.stamp(repository.uuid, priorRow.payloadVersion, git.binding)
|
|
53
|
-
!== priorRow.gitConfigurationObservation)
|
|
54
|
-
return "configuration-pair";
|
|
55
|
-
const local = (entry) => repository.relativePath
|
|
56
|
-
? entry.relativePath.slice(repository.relativePath.length + 1) : entry.relativePath;
|
|
57
|
-
// Fresh leaf evidence and Git state together determine the logical result.
|
|
58
|
-
// Historical inode/time equality is not necessary for cargo reuse; this
|
|
59
|
-
// attempt's own physical witnesses still close at Record.
|
|
60
|
-
const unchangedSinceSeal = (entry) => {
|
|
61
|
-
const row = prior(entry.relativePath);
|
|
62
|
-
return row !== undefined
|
|
63
|
-
&& row.uuid === entry.uuid
|
|
64
|
-
&& row.type === entry.type
|
|
65
|
-
&& (entry.type === "repo.git" || row.payloadVersion === entry.payloadVersion)
|
|
66
|
-
&& portableFileMode(row.type, row.filesystemMode) === portableFileMode(entry.type, entry.filesystemMode);
|
|
67
|
-
};
|
|
68
|
-
const identity = [];
|
|
69
|
-
let examined = 0;
|
|
70
|
-
const member = (entry) => void identity.push({ path: local(entry), uuid: entry.uuid, type: entry.type,
|
|
71
|
-
payloadVersion: entry.type === "repo.git" ? null : entry.payloadVersion });
|
|
72
|
-
for (const entry of owned) {
|
|
73
|
-
if (!unchangedSinceSeal(entry))
|
|
74
|
-
return "worktree-changed";
|
|
75
|
-
member(entry);
|
|
76
|
-
if (held?.examines(entry.uuid))
|
|
77
|
-
examined += 1;
|
|
78
|
-
if (identity.length % ITEMS_PER_BOUNDARY === 0)
|
|
79
|
-
yield;
|
|
80
|
-
}
|
|
81
|
-
if (held === null) {
|
|
82
|
-
return sealed.identityHash === (yield* repositoryIdentityHashSteps(identity, createSha256)) ? null : "worktree-changed";
|
|
83
|
-
}
|
|
84
|
-
// Distinct walked entries, each one examined row: with the counts equal,
|
|
85
|
-
// they are every examined row.
|
|
86
|
-
if (sealed.membersRevision === held.membersRevision && examined === owned.length && examined === held.examined)
|
|
87
|
-
return null;
|
|
88
|
-
// A held member is O's one row at its path, so it is unchanged since O.
|
|
89
|
-
for (const entry of (yield* held.members()).values()) {
|
|
90
|
-
member(entry);
|
|
91
|
-
if (identity.length % ITEMS_PER_BOUNDARY === 0)
|
|
92
|
-
yield;
|
|
93
|
-
}
|
|
94
|
-
return sealed.identityHash === (yield* repositoryIdentityHashSteps(identity, createSha256)) ? null : "worktree-changed";
|
|
95
|
-
}
|
|
96
|
-
/** One examination derived both results: O's observed payload and the
|
|
97
|
-
* selected result sharing holds. */
|
|
98
|
-
export function sealDerives(sealed, observed, shared) {
|
|
99
|
-
return sealed !== null && sealed.observedPayload === observed.payloadVersion
|
|
100
|
-
&& sealed.selection?.payloadVersion === shared.payloadVersion
|
|
101
|
-
&& sealed.selection.transportVersion === shared.transportVersion;
|
|
102
|
-
}
|
|
103
|
-
//# sourceMappingURL=seal-law.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"seal-law.js","sourceRoot":"","sources":["../../src/detection/seal-law.ts"],"names":[],"mappings":"AAAA;;;uBAGuB;AACvB,OAAO,EAAE,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AI,MAAM,CAAC,eAAe,KAAK,QAAQ,CAAC,cAAc;WACvE,MAAM,CAAC,SAAS,EAAE,cAAc,KAAK,MAAM,CAAC,cAAc;WAC1D,MAAM,CAAC,SAAS,CAAC,gBAAgB,KAAK,MAAM,CAAC,gBAAgB,CAAC;AACrE,CAAC"}
|
package/dist/git-capture.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { RepoStashEntry } from "@amalgm/live";
|
|
2
|
-
import { type GitBindingProof } from "./git-binding.js";
|
|
3
|
-
import { type CardFact } from "./git-card.js";
|
|
4
|
-
import { type GitConfigurationObservation } from "./git-configuration.js";
|
|
5
|
-
import { type GitEvidence } from "./git-evidence.js";
|
|
6
|
-
import { type GitIndexEntry } from "./git-index-entries.js";
|
|
7
|
-
import { NativeIndexSnapshot } from "./git-native-index.js";
|
|
8
|
-
import { type GitRecords, type GitSealRefusal, type StorageRecords } from "./git-records.js";
|
|
9
|
-
import { type SourceProof } from "./source-proof.js";
|
|
10
|
-
export interface GitFact<T> {
|
|
11
|
-
readonly value: T;
|
|
12
|
-
/** Unclosed: the admission that trusts the value closes it. */
|
|
13
|
-
readonly proof: SourceProof;
|
|
14
|
-
}
|
|
15
|
-
/** Index entries under one scope, drawn from one native index read. What the
|
|
16
|
-
* worktree holds beside them is the walk's to say (git-spelling.ts). */
|
|
17
|
-
export interface GitInventory {
|
|
18
|
-
readonly index: readonly GitIndexEntry[];
|
|
19
|
-
readonly proof: SourceProof;
|
|
20
|
-
}
|
|
21
|
-
/** The records that decide this capture's Git answers, or why none do. */
|
|
22
|
-
export interface GitCertificate {
|
|
23
|
-
readonly storage: StorageRecords;
|
|
24
|
-
readonly refs: GitRecords;
|
|
25
|
-
readonly key: string;
|
|
26
|
-
readonly proof: SourceProof;
|
|
27
|
-
}
|
|
28
|
-
/** A path lies in scope when it or one of its ancestors is a scope entry. */
|
|
29
|
-
export declare function inScope(scope: ReadonlySet<string>, path: string): boolean;
|
|
30
|
-
export declare class GitCapture {
|
|
31
|
-
#private;
|
|
32
|
-
readonly repository: string;
|
|
33
|
-
constructor(repository: string);
|
|
34
|
-
binding(): Promise<GitBindingProof>;
|
|
35
|
-
configuration(): Promise<GitConfigurationObservation>;
|
|
36
|
-
certificate(): Promise<GitCertificate | GitSealRefusal>;
|
|
37
|
-
stash(): Promise<GitFact<readonly RepoStashEntry[]>>;
|
|
38
|
-
card(): Promise<CardFact>;
|
|
39
|
-
evidence(): Promise<GitEvidence>;
|
|
40
|
-
/** Under certified storage, the index a previous capture decoded lends its
|
|
41
|
-
* listing when the bytes read back the same (git-native-index.ts). */
|
|
42
|
-
index(): Promise<NativeIndexSnapshot>;
|
|
43
|
-
/** Every scope filters the one stage listing, under its proof: the index
|
|
44
|
-
* answer is its meaning, held by its witness, and never depends on the
|
|
45
|
-
* worktree. */
|
|
46
|
-
inventory(scope: readonly string[] | null): Promise<GitInventory>;
|
|
47
|
-
}
|
package/dist/git-capture.js
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
/** One repository attempt asks Git each question once. Every consumer of the
|
|
2
|
-
* attempt shares the same answer and retains the same proof, so admission
|
|
3
|
-
* closes each fact once however many consumers depend on it. Inside the
|
|
4
|
-
* records' profile (git-records.ts) an answer's proof is the native records
|
|
5
|
-
* that decide it, and an answer held under equal records is not asked again
|
|
6
|
-
* (git-facts.ts); outside it, Git is asked again to close. A failed ask
|
|
7
|
-
* leaves no fact; a retry after a source change begins a new capture. */
|
|
8
|
-
import { join } from "node:path";
|
|
9
|
-
import { collectGitBinding } from "./git-binding.js";
|
|
10
|
-
import { askCard, askedCard, cardFact, collectStash, stashList } from "./git-card.js";
|
|
11
|
-
import { askGitConfiguration, configurationObservation, } from "./git-configuration.js";
|
|
12
|
-
import { collectGitEvidence } from "./git-evidence.js";
|
|
13
|
-
import { heldAnswer, holdAnswer } from "./git-facts.js";
|
|
14
|
-
import { assertGitPath } from "./git-index-entries.js";
|
|
15
|
-
import { NativeIndexSnapshot } from "./git-native-index.js";
|
|
16
|
-
import { recordsRefused, refsRecords, refuse, storageRecords, } from "./git-records.js";
|
|
17
|
-
import { settleAll } from "./settled.js";
|
|
18
|
-
import { closePhysically, sourceProofs } from "./source-proof.js";
|
|
19
|
-
import { eachInTurns } from "./turns.js";
|
|
20
|
-
/** A path lies in scope when it or one of its ancestors is a scope entry. */
|
|
21
|
-
export function inScope(scope, path) {
|
|
22
|
-
for (let end = path.length; end > 0; end = path.lastIndexOf("/", end - 1)) {
|
|
23
|
-
if (scope.has(path.slice(0, end)))
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
/** The answers the storage records decide: Git binds the checkout as its own
|
|
29
|
-
* worktree over the records' one storage directory, files refs. */
|
|
30
|
-
function storageRefusal(records, binding, configuration) {
|
|
31
|
-
if (configuration.keys.has("extensions.refstorage"))
|
|
32
|
-
return refuse("unsupported-storage", "extensions.refstorage");
|
|
33
|
-
if (binding.repository !== records.repository || binding.gitDir !== records.gitDir
|
|
34
|
-
|| binding.common !== records.gitDir || binding.index !== join(records.gitDir, "index"))
|
|
35
|
-
return refuse("storage-layout");
|
|
36
|
-
return binding.worktree === binding.repository ? null : refuse("worktree");
|
|
37
|
-
}
|
|
38
|
-
const certified = (records, held) => ({ records,
|
|
39
|
-
binding: Object.freeze(Object.assign(sourceProofs([records.proof]), { binding: held.binding })),
|
|
40
|
-
configuration: configurationObservation(held.configuration, records.proof) });
|
|
41
|
-
export class GitCapture {
|
|
42
|
-
repository;
|
|
43
|
-
#facts = new Map();
|
|
44
|
-
constructor(repository) { this.repository = repository; }
|
|
45
|
-
#once(key, ask) {
|
|
46
|
-
let fact = this.#facts.get(key);
|
|
47
|
-
if (!fact) {
|
|
48
|
-
const asked = ask();
|
|
49
|
-
fact = asked;
|
|
50
|
-
this.#facts.set(key, asked);
|
|
51
|
-
asked.catch(() => { if (this.#facts.get(key) === asked)
|
|
52
|
-
this.#facts.delete(key); });
|
|
53
|
-
}
|
|
54
|
-
return fact;
|
|
55
|
-
}
|
|
56
|
-
/** An answer held under `key`, or asked now and held once the records it
|
|
57
|
-
* was asked under read back unchanged. */
|
|
58
|
-
async #held(repository, name, key, proof, ask) {
|
|
59
|
-
const held = heldAnswer(repository, name, key);
|
|
60
|
-
if (held !== undefined)
|
|
61
|
-
return held;
|
|
62
|
-
const value = await ask();
|
|
63
|
-
closePhysically(proof);
|
|
64
|
-
holdAnswer(repository, name, key, value);
|
|
65
|
-
return value;
|
|
66
|
-
}
|
|
67
|
-
#storage() {
|
|
68
|
-
return this.#once("storage", async () => {
|
|
69
|
-
const records = storageRecords(this.repository);
|
|
70
|
-
if (recordsRefused(records)) {
|
|
71
|
-
const [binding, asked] = await settleAll([collectGitBinding(this.repository), askGitConfiguration(this.repository)]);
|
|
72
|
-
return { binding, configuration: configurationObservation(asked.answer, asked.proof), records };
|
|
73
|
-
}
|
|
74
|
-
const known = heldAnswer(records.repository, "storage", records.key);
|
|
75
|
-
if (known)
|
|
76
|
-
return certified(records, known);
|
|
77
|
-
const [binding, asked] = await settleAll([collectGitBinding(this.repository), askGitConfiguration(this.repository)]);
|
|
78
|
-
const refused = storageRefusal(records, binding.binding, asked.answer);
|
|
79
|
-
if (refused)
|
|
80
|
-
return { binding, configuration: configurationObservation(asked.answer, asked.proof), records: refused };
|
|
81
|
-
// Asked under these records: held once they read back unchanged.
|
|
82
|
-
closePhysically(records.proof);
|
|
83
|
-
const held = { binding: binding.binding, configuration: asked.answer };
|
|
84
|
-
holdAnswer(records.repository, "storage", records.key, held);
|
|
85
|
-
return certified(records, held);
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
binding() { return this.#storage().then(storage => storage.binding); }
|
|
89
|
-
configuration() { return this.#storage().then(storage => storage.configuration); }
|
|
90
|
-
certificate() {
|
|
91
|
-
return this.#once("certificate", async () => {
|
|
92
|
-
const { records: storage } = await this.#storage();
|
|
93
|
-
if (recordsRefused(storage))
|
|
94
|
-
return storage;
|
|
95
|
-
const refs = refsRecords(storage.gitDir);
|
|
96
|
-
if (recordsRefused(refs))
|
|
97
|
-
return refs;
|
|
98
|
-
return Object.freeze({ storage, refs, key: `${storage.key}:${refs.key}`, proof: sourceProofs([storage.proof, refs.proof]) });
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
stash() {
|
|
102
|
-
return this.#once("stash", async () => {
|
|
103
|
-
const certificate = await this.certificate();
|
|
104
|
-
if (recordsRefused(certificate))
|
|
105
|
-
return collectStash(this.repository);
|
|
106
|
-
const value = await this.#held(certificate.storage.repository, "stash", certificate.key, certificate.proof, async () => Object.freeze(await stashList(this.repository)));
|
|
107
|
-
return { value, proof: certificate.proof };
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
card() {
|
|
111
|
-
return this.#once("card", async () => {
|
|
112
|
-
const shallow = () => this.binding().then(({ binding }) => binding.shallow);
|
|
113
|
-
const asked = this.certificate().then(async (certificate) => recordsRefused(certificate)
|
|
114
|
-
? askedCard(this.repository, shallow())
|
|
115
|
-
: { proof: certificate.proof, value: await this.#held(certificate.storage.repository, "card", certificate.key, certificate.proof, () => askCard(this.repository, shallow())) });
|
|
116
|
-
const [binding, configuration, stash, card] = await settleAll([this.binding(), this.configuration(), this.stash(), asked]);
|
|
117
|
-
return cardFact(binding, configuration, stash, card);
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
evidence() { return this.#once("evidence", () => collectGitEvidence(this)); }
|
|
121
|
-
/** Under certified storage, the index a previous capture decoded lends its
|
|
122
|
-
* listing when the bytes read back the same (git-native-index.ts). */
|
|
123
|
-
index() {
|
|
124
|
-
return this.#once("index", async () => {
|
|
125
|
-
const { binding, records } = await this.#storage();
|
|
126
|
-
if (recordsRefused(records))
|
|
127
|
-
return NativeIndexSnapshot.observe(binding.binding);
|
|
128
|
-
const held = heldAnswer(records.repository, "index", records.key) ?? null;
|
|
129
|
-
const snapshot = await NativeIndexSnapshot.observe(binding.binding, held);
|
|
130
|
-
holdAnswer(records.repository, "index", records.key, snapshot, snapshot.bytes);
|
|
131
|
-
return snapshot;
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
/** Every scope filters the one stage listing, under its proof: the index
|
|
135
|
-
* answer is its meaning, held by its witness, and never depends on the
|
|
136
|
-
* worktree. */
|
|
137
|
-
async inventory(scope) {
|
|
138
|
-
scope?.forEach(assertGitPath);
|
|
139
|
-
const binding = await this.binding();
|
|
140
|
-
const snapshot = await this.index();
|
|
141
|
-
const proof = sourceProofs([binding, snapshot.proof]);
|
|
142
|
-
if (scope?.length === 0)
|
|
143
|
-
return { index: [], proof };
|
|
144
|
-
const listing = await snapshot.entries();
|
|
145
|
-
if (scope === null)
|
|
146
|
-
return { index: listing, proof };
|
|
147
|
-
const selected = new Set(scope), index = [];
|
|
148
|
-
await eachInTurns(listing, entry => { if (inScope(selected, entry.path))
|
|
149
|
-
index.push(entry); });
|
|
150
|
-
return { index, proof };
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
//# sourceMappingURL=git-capture.js.map
|
package/dist/git-capture.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"git-capture.js","sourceRoot":"","sources":["../src/git-capture.ts"],"names":[],"mappings":"AAAA;;;;;;yEAMyE;AACzE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,iBAAiB,EAAiD,MAAM,kBAAkB,CAAC;AACpG,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAkC,MAAM,eAAe,CAAC;AACtH,OAAO,EACL,mBAAmB,EAAE,wBAAwB,GAC9C,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAoB,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAsB,MAAM,wBAAwB,CAAC;AAC3E,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oStashEntry, type RepoState } from "@amalgm/live";
|
|
2
|
-
import type { GitBindingProof } from "./git-binding.js";
|
|
3
|
-
import type { GitFact } from "./git-capture.js";
|
|
4
|
-
import type { GitConfigurationObservation } from "./git-configuration.js";
|
|
5
|
-
/** The stash stack newest first, exactly as Git's reflog holds it. `%gs` is
|
|
6
|
-
* the reflog subject after Git's own whitespace normalization, so storing a
|
|
7
|
-
* captured message reads back unchanged. */
|
|
8
|
-
export declare function stashList(repository: string, closing?: boolean): Promise<RepoStashEntry[]>;
|
|
9
|
-
/** Outside the records' profile, Git can follow a symbolic stash ref to a
|
|
10
|
-
* different reflog, so only Git's own answer again closes it. */
|
|
11
|
-
export declare function collectStash(repository: string): Promise<GitFact<readonly RepoStashEntry[]>>;
|
|
12
|
-
/** The Card's own answers, asked together. */
|
|
13
|
-
export type CardAnswer = Awaited<ReturnType<typeof askCard>>;
|
|
14
|
-
export declare function askCard(repository: string, shallowFile: Promise<string>, closing?: boolean): Promise<Readonly<{
|
|
15
|
-
branch: string | null;
|
|
16
|
-
commit: string | null;
|
|
17
|
-
tree: string | null;
|
|
18
|
-
refs: RepoRef[];
|
|
19
|
-
shallow: string[];
|
|
20
|
-
}>>;
|
|
21
|
-
/** Outside the records' profile, Git's own answer again closes the Card's. */
|
|
22
|
-
export declare function askedCard(repository: string, shallowFile: Promise<string>): Promise<GitFact<CardAnswer>>;
|
|
23
|
-
/** The Card, with HEAD's tree: the base every Checkpoint patch is stated
|
|
24
|
-
* against, null when HEAD is unborn. */
|
|
25
|
-
export interface CardFact extends GitFact<RepoState["card"]> {
|
|
26
|
-
readonly tree: string | null;
|
|
27
|
-
}
|
|
28
|
-
/** HEAD, refs and the shallow boundary are the Card's own answer; the stash,
|
|
29
|
-
* remotes and object format are the capture's shared facts. */
|
|
30
|
-
export declare function cardFact(binding: GitBindingProof, configuration: GitConfigurationObservation, stash: GitFact<readonly RepoStashEntry[]>, asked: GitFact<CardAnswer>): CardFact;
|
package/dist/git-card.js
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
/** The Card: committed Git state as Git answers it. Each answer is one fact of
|
|
2
|
-
* a repository capture, closed by the native records that decide it
|
|
3
|
-
* (git-records.ts), or outside that profile by asking Git again. */
|
|
4
|
-
import { readFile } from "node:fs/promises";
|
|
5
|
-
import { REPOSITORY_CARD_VERSION, portableRefName, refusal, } from "@amalgm/live";
|
|
6
|
-
import { CaptureSourceChangedError } from "./content-cache-host.js";
|
|
7
|
-
import { gitText, runGitSearch } from "./git-command.js";
|
|
8
|
-
import { looseRefs } from "./git-ref-store.js";
|
|
9
|
-
import { settleAll } from "./settled.js";
|
|
10
|
-
import { semanticProof, sourceProofs } from "./source-proof.js";
|
|
11
|
-
/** Every stored ref except Amalgm's private import namespace and
|
|
12
|
-
* `refs/stash`, whose value names only the top of a stack that lives in the
|
|
13
|
-
* reflog; the stack travels whole through `stashList`. for-each-ref gives each
|
|
14
|
-
* direct value; the loose store gives each symbolic ref's immediate target and
|
|
15
|
-
* every ref for-each-ref omitted. A dangling or cyclic symbolic ref is Git
|
|
16
|
-
* state like any other and travels as stored. A stored ref Git cannot read,
|
|
17
|
-
* or a name or target no Card can carry, is refused. */
|
|
18
|
-
async function refList(repository, closing) {
|
|
19
|
-
const output = await gitText(repository, ["for-each-ref", "--format=%(refname)%00%(objectname)%00%(symref)", "refs"], { purpose: "card", closing });
|
|
20
|
-
const direct = new Map();
|
|
21
|
-
const symbolic = new Set();
|
|
22
|
-
for (const line of output ? output.split("\n") : []) {
|
|
23
|
-
const [name, commit, target] = line.split("\0");
|
|
24
|
-
if (target)
|
|
25
|
-
symbolic.add(name);
|
|
26
|
-
else
|
|
27
|
-
direct.set(name, commit);
|
|
28
|
-
}
|
|
29
|
-
const refs = [...direct].map(([name, commit]) => ({ name, kind: "direct", commit }));
|
|
30
|
-
const stored = looseRefs(repository);
|
|
31
|
-
for (const name of symbolic) {
|
|
32
|
-
if (!stored.has(name))
|
|
33
|
-
throw new CaptureSourceChangedError("repository ref store changed");
|
|
34
|
-
}
|
|
35
|
-
for (const [name, read] of stored) {
|
|
36
|
-
if (direct.has(name))
|
|
37
|
-
continue;
|
|
38
|
-
const ref = read();
|
|
39
|
-
if (ref.kind === "direct")
|
|
40
|
-
throw new CaptureSourceChangedError("repository ref store changed");
|
|
41
|
-
if (ref.kind === "unreadable")
|
|
42
|
-
throw refusal(`repository stores a ref Git cannot read: ${name}`);
|
|
43
|
-
refs.push({ name, kind: "symbolic", target: ref.target });
|
|
44
|
-
}
|
|
45
|
-
return refs.filter(ref => ref.name !== "refs/stash" && !ref.name.startsWith("refs/amalgm-import/"))
|
|
46
|
-
.map(ref => {
|
|
47
|
-
if (!portableRefName(ref.name) || (ref.kind === "symbolic" && !portableRefName(ref.target))) {
|
|
48
|
-
throw refusal(`repository ref cannot travel: ${ref.name}`);
|
|
49
|
-
}
|
|
50
|
-
return ref;
|
|
51
|
-
})
|
|
52
|
-
.sort((left, right) => left.name < right.name ? -1 : left.name > right.name ? 1 : 0);
|
|
53
|
-
}
|
|
54
|
-
/** The stash stack newest first, exactly as Git's reflog holds it. `%gs` is
|
|
55
|
-
* the reflog subject after Git's own whitespace normalization, so storing a
|
|
56
|
-
* captured message reads back unchanged. */
|
|
57
|
-
export async function stashList(repository, closing = false) {
|
|
58
|
-
const output = await gitText(repository, ["stash", "list", "--format=%H%x00%gs"], { purpose: "card", closing });
|
|
59
|
-
if (!output)
|
|
60
|
-
return [];
|
|
61
|
-
return output.split("\n").map((line) => {
|
|
62
|
-
const separator = line.indexOf("\0");
|
|
63
|
-
return { commit: line.slice(0, separator), message: line.slice(separator + 1) };
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
/** Outside the records' profile, Git can follow a symbolic stash ref to a
|
|
67
|
-
* different reflog, so only Git's own answer again closes it. */
|
|
68
|
-
export async function collectStash(repository) {
|
|
69
|
-
const value = Object.freeze(await stashList(repository));
|
|
70
|
-
const answer = JSON.stringify(value);
|
|
71
|
-
return { value, proof: semanticProof(async () => {
|
|
72
|
-
if (JSON.stringify(await stashList(repository, true)) !== answer) {
|
|
73
|
-
throw new CaptureSourceChangedError("repository stash changed");
|
|
74
|
-
}
|
|
75
|
-
}) };
|
|
76
|
-
}
|
|
77
|
-
/** A shallow boundary changes the visible history graph and participates in
|
|
78
|
-
* the Card fingerprint, even when the branch tip itself is unchanged. Its
|
|
79
|
-
* location is the binding's, so only the file itself is read here. */
|
|
80
|
-
async function shallowBoundary(file) {
|
|
81
|
-
let text;
|
|
82
|
-
try {
|
|
83
|
-
text = await readFile(file, "utf8");
|
|
84
|
-
}
|
|
85
|
-
catch (error) {
|
|
86
|
-
if (error.code === "ENOENT")
|
|
87
|
-
return [];
|
|
88
|
-
throw error;
|
|
89
|
-
}
|
|
90
|
-
const commits = text.split(/\r?\n/).filter(Boolean).sort();
|
|
91
|
-
if (commits.some((commit) => !/^[0-9a-f]{40,64}$/.test(commit))) {
|
|
92
|
-
throw new Error("repository has an invalid shallow boundary");
|
|
93
|
-
}
|
|
94
|
-
return commits;
|
|
95
|
-
}
|
|
96
|
-
/** HEAD and the tree it names, in one ask. An unborn HEAD names neither;
|
|
97
|
-
* revs-only skips each, so any other count is a HEAD Git cannot peel. The
|
|
98
|
-
* tree is peeled as the private view reads objects: without replacement. */
|
|
99
|
-
async function headAndTree(repository, closing) {
|
|
100
|
-
const named = await gitText(repository, ["rev-parse", "--revs-only", "HEAD", "HEAD^{tree}"], { purpose: "card", closing, profile: { GIT_NO_REPLACE_OBJECTS: "1" } });
|
|
101
|
-
const [commit, tree, ...rest] = named ? named.split("\n") : [];
|
|
102
|
-
if (named && (tree === undefined || rest.length))
|
|
103
|
-
throw new Error("repository HEAD does not name a tree");
|
|
104
|
-
return { commit: commit ?? null, tree: tree ?? null };
|
|
105
|
-
}
|
|
106
|
-
export async function askCard(repository, shallowFile, closing = false) {
|
|
107
|
-
const card = { purpose: "card", closing };
|
|
108
|
-
const [branch, { commit, tree }, refs, shallow] = await settleAll([
|
|
109
|
-
runGitSearch(repository, ["symbolic-ref", "-q", "--short", "HEAD"], card).then(named => named.toString("utf8").trim() || null),
|
|
110
|
-
headAndTree(repository, closing), refList(repository, closing), shallowFile.then(shallowBoundary)
|
|
111
|
-
]);
|
|
112
|
-
return Object.freeze({ branch, commit, tree, refs, shallow });
|
|
113
|
-
}
|
|
114
|
-
/** Outside the records' profile, Git's own answer again closes the Card's. */
|
|
115
|
-
export async function askedCard(repository, shallowFile) {
|
|
116
|
-
const value = await askCard(repository, shallowFile), answer = JSON.stringify(value);
|
|
117
|
-
return { value, proof: semanticProof(async () => {
|
|
118
|
-
if (JSON.stringify(await askCard(repository, shallowFile, true)) !== answer) {
|
|
119
|
-
throw new CaptureSourceChangedError("repository Git basis changed after capture");
|
|
120
|
-
}
|
|
121
|
-
}) };
|
|
122
|
-
}
|
|
123
|
-
/** HEAD, refs and the shallow boundary are the Card's own answer; the stash,
|
|
124
|
-
* remotes and object format are the capture's shared facts. */
|
|
125
|
-
export function cardFact(binding, configuration, stash, asked) {
|
|
126
|
-
const { branch, commit, tree, refs, shallow } = asked.value;
|
|
127
|
-
const value = {
|
|
128
|
-
version: REPOSITORY_CARD_VERSION,
|
|
129
|
-
objectFormat: binding.binding.format,
|
|
130
|
-
head: { branch, commit, detached: branch === null && commit !== null },
|
|
131
|
-
refs: [...refs], stash: [...stash.value], remotes: configuration.remotes,
|
|
132
|
-
...(shallow.length > 0 ? { shallow: [...shallow] } : {}),
|
|
133
|
-
};
|
|
134
|
-
return { value, tree, proof: sourceProofs([asked.proof, stash.proof, configuration, binding]) };
|
|
135
|
-
}
|
|
136
|
-
//# sourceMappingURL=git-card.js.map
|
package/dist/git-card.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"git-card.js","sourceRoot":"","sources":["../src/git-card.ts"],"names":[],"mappings":"AAAA;;oEAEoE;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EACL,uBAAuB,EAAE,eA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algm/live";
|
|
2
|
-
import { type GitIndexEntry } from "./git-index-entries.js";
|
|
3
|
-
import { type LiteralRequest } from "./git-literal-read.js";
|
|
4
|
-
import type { PrivateGitView } from "./git-private-view.js";
|
|
5
|
-
export interface CheckpointWorkingFile {
|
|
6
|
-
/** Null only for a tracked leaf whose bytes are exactly its indexed blob. */
|
|
7
|
-
readonly content: Buffer | null;
|
|
8
|
-
/** Null only for such a leaf that was proven rather than read. */
|
|
9
|
-
readonly sha256: string | null;
|
|
10
|
-
readonly objectId: string;
|
|
11
|
-
readonly mode: "100644" | "100755" | "120000";
|
|
12
|
-
}
|
|
13
|
-
type Independent = (path: string) => boolean;
|
|
14
|
-
export declare const independentOf: (boundaries: readonly string[]) => Independent;
|
|
15
|
-
/** The paths Git's index accounts for with a blob: a stage-zero blob, or a
|
|
16
|
-
* conflict with a blob stage. Every other owned leaf, a file where a gitlink
|
|
17
|
-
* stands included, is Checkpoint cargo beside Git's index. */
|
|
18
|
-
export declare function accountedPaths(index: readonly GitIndexEntry[], independent: Independent): Promise<Set<string>>;
|
|
19
|
-
/** Every working path construction reads, and the bytes each may need: a
|
|
20
|
-
* tracked leaf's only when they are not its indexed blob. */
|
|
21
|
-
export declare function checkpointReads(index: readonly GitIndexEntry[], boundaries: readonly string[], additionalPaths: readonly string[]): Promise<LiteralRequest[]>;
|
|
22
|
-
export interface ConstructedLiteralCheckpoint {
|
|
23
|
-
readonly stagedPatch: Buffer;
|
|
24
|
-
readonly unstagedPatch: Buffer;
|
|
25
|
-
readonly untracked: readonly {
|
|
26
|
-
path: string;
|
|
27
|
-
mode: string;
|
|
28
|
-
content: Buffer;
|
|
29
|
-
sha256: string;
|
|
30
|
-
}[];
|
|
31
|
-
readonly unmerged: readonly RepoUnmergedPath[];
|
|
32
|
-
readonly indexFlags: readonly RepoIndexFlags[];
|
|
33
|
-
}
|
|
34
|
-
/** `additionalPaths` includes every selected leaf the index does not account
|
|
35
|
-
* for, including retained shared leaves no longer present in the source
|
|
36
|
-
* worktree, in any order: a Checkpoint names its untracked files in path
|
|
37
|
-
* order, so one ground has one Checkpoint whoever selected it.
|
|
38
|
-
* The same constructor serves ordinary capture and selected publication.
|
|
39
|
-
* `base` is HEAD's tree from the Card, null when HEAD is unborn. Both trees
|
|
40
|
-
* arrive from one Git process while another writes the changed blobs, and
|
|
41
|
-
* both patches come from one diff. The index travels as Git keeps it: its
|
|
42
|
-
* listing in the patches, and each flagged stage-zero entry's flags beside
|
|
43
|
-
* them in the index's order. */
|
|
44
|
-
export declare function constructLiteralCheckpoint(input: {
|
|
45
|
-
readonly view: PrivateGitView;
|
|
46
|
-
readonly index: readonly GitIndexEntry[];
|
|
47
|
-
/** The index's `accountedPaths` under these boundaries. */
|
|
48
|
-
readonly accounted: ReadonlySet<string>;
|
|
49
|
-
readonly base: string | null;
|
|
50
|
-
readonly boundaries: readonly string[];
|
|
51
|
-
readonly additionalPaths: readonly string[];
|
|
52
|
-
readonly read: (path: string) => CheckpointWorkingFile | null;
|
|
53
|
-
}): Promise<ConstructedLiteralCheckpoint>;
|
|
54
|
-
export {};
|