@yaks/git 0.0.0-stage → 0.2.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +754 -2
  3. package/_dist/address.d.ts +6 -0
  4. package/_dist/address.d.ts.map +1 -0
  5. package/_dist/checkout_vocab.d.ts +3 -0
  6. package/_dist/checkout_vocab.d.ts.map +1 -0
  7. package/_dist/cites.d.ts +48 -0
  8. package/_dist/cites.d.ts.map +1 -0
  9. package/_dist/commit.d.ts +36 -0
  10. package/_dist/commit.d.ts.map +1 -0
  11. package/_dist/comp.d.ts +29 -0
  12. package/_dist/comp.d.ts.map +1 -0
  13. package/_dist/door.d.ts +29 -0
  14. package/_dist/door.d.ts.map +1 -0
  15. package/_dist/format.d.ts +2 -0
  16. package/_dist/format.d.ts.map +1 -0
  17. package/_dist/hold.d.ts +6 -0
  18. package/_dist/hold.d.ts.map +1 -0
  19. package/_dist/host.d.ts +126 -0
  20. package/_dist/host.d.ts.map +1 -0
  21. package/_dist/http.d.ts +33 -0
  22. package/_dist/http.d.ts.map +1 -0
  23. package/_dist/import.d.ts +13 -0
  24. package/_dist/import.d.ts.map +1 -0
  25. package/_dist/index.d.ts +80 -0
  26. package/_dist/index.d.ts.map +1 -0
  27. package/_dist/land.d.ts +77 -0
  28. package/_dist/land.d.ts.map +1 -0
  29. package/_dist/mod.d.ts +73 -0
  30. package/_dist/mod.d.ts.map +1 -0
  31. package/_dist/objects.d.ts +40 -0
  32. package/_dist/objects.d.ts.map +1 -0
  33. package/_dist/oid.d.ts +24 -0
  34. package/_dist/oid.d.ts.map +1 -0
  35. package/_dist/pack-store.d.ts +9 -0
  36. package/_dist/pack-store.d.ts.map +1 -0
  37. package/_dist/pack.d.ts +26 -0
  38. package/_dist/pack.d.ts.map +1 -0
  39. package/_dist/pkt.d.ts +14 -0
  40. package/_dist/pkt.d.ts.map +1 -0
  41. package/_dist/placement.d.ts +4 -0
  42. package/_dist/placement.d.ts.map +1 -0
  43. package/_dist/plugin.d.ts +43 -0
  44. package/_dist/plugin.d.ts.map +1 -0
  45. package/_dist/project.d.ts +20 -0
  46. package/_dist/project.d.ts.map +1 -0
  47. package/_dist/push.d.ts +42 -0
  48. package/_dist/push.d.ts.map +1 -0
  49. package/_dist/refs.d.ts +81 -0
  50. package/_dist/refs.d.ts.map +1 -0
  51. package/_dist/rewrite.d.ts +35 -0
  52. package/_dist/rewrite.d.ts.map +1 -0
  53. package/_dist/service.d.ts +35 -0
  54. package/_dist/service.d.ts.map +1 -0
  55. package/_dist/sha1.d.ts +11 -0
  56. package/_dist/sha1.d.ts.map +1 -0
  57. package/_dist/source.d.ts +12 -0
  58. package/_dist/source.d.ts.map +1 -0
  59. package/_dist/tools.d.ts +11 -0
  60. package/_dist/tools.d.ts.map +1 -0
  61. package/_dist/tree.d.ts +28 -0
  62. package/_dist/tree.d.ts.map +1 -0
  63. package/_dist/unpack.d.ts +5 -0
  64. package/_dist/unpack.d.ts.map +1 -0
  65. package/_dist/vocab.d.ts +8 -0
  66. package/_dist/vocab.d.ts.map +1 -0
  67. package/_dist/workspace.d.ts +17 -0
  68. package/_dist/workspace.d.ts.map +1 -0
  69. package/address.js +9 -0
  70. package/address.js.map +1 -0
  71. package/address.ts +15 -0
  72. package/cache.js +9 -0
  73. package/cache.js.map +1 -0
  74. package/cache.ts +6 -0
  75. package/checkout.js +18 -0
  76. package/checkout.js.map +1 -0
  77. package/checkout.ts +24 -0
  78. package/checkout_vocab.js +14 -0
  79. package/checkout_vocab.js.map +1 -0
  80. package/checkout_vocab.ts +11 -0
  81. package/cites.js +189 -0
  82. package/cites.js.map +1 -0
  83. package/cites.ts +206 -0
  84. package/commit.js +128 -0
  85. package/commit.js.map +1 -0
  86. package/commit.ts +183 -0
  87. package/comp.js +94 -0
  88. package/comp.js.map +1 -0
  89. package/comp.ts +111 -0
  90. package/deno.json +1 -0
  91. package/door.js +88 -0
  92. package/door.js.map +1 -0
  93. package/door.ts +142 -0
  94. package/format.js +43 -0
  95. package/format.js.map +1 -0
  96. package/format.ts +49 -0
  97. package/hold.js +17 -0
  98. package/hold.js.map +1 -0
  99. package/hold.ts +21 -0
  100. package/host.js +1024 -0
  101. package/host.js.map +1 -0
  102. package/host.ts +1140 -0
  103. package/http.js +268 -0
  104. package/http.js.map +1 -0
  105. package/http.ts +329 -0
  106. package/import.js +141 -0
  107. package/import.js.map +1 -0
  108. package/import.ts +128 -0
  109. package/index.js +496 -0
  110. package/index.js.map +1 -0
  111. package/index.ts +634 -0
  112. package/land.js +788 -0
  113. package/land.js.map +1 -0
  114. package/land.ts +871 -0
  115. package/mod.js +73 -0
  116. package/mod.js.map +1 -0
  117. package/mod.ts +74 -0
  118. package/objects.js +331 -0
  119. package/objects.js.map +1 -0
  120. package/objects.ts +390 -0
  121. package/oid.js +50 -0
  122. package/oid.js.map +1 -0
  123. package/oid.ts +83 -0
  124. package/pack-index.js +103 -0
  125. package/pack-index.js.map +1 -0
  126. package/pack-index.ts +104 -0
  127. package/pack-store.js +216 -0
  128. package/pack-store.js.map +1 -0
  129. package/pack-store.ts +292 -0
  130. package/pack.js +121 -0
  131. package/pack.js.map +1 -0
  132. package/pack.ts +146 -0
  133. package/package.json +78 -4
  134. package/pkt.js +73 -0
  135. package/pkt.js.map +1 -0
  136. package/pkt.ts +93 -0
  137. package/placement.js +44 -0
  138. package/placement.js.map +1 -0
  139. package/placement.ts +38 -0
  140. package/plugin.js +66 -0
  141. package/plugin.js.map +1 -0
  142. package/plugin.ts +88 -0
  143. package/process-cwd.py +57 -0
  144. package/project.js +142 -0
  145. package/project.js.map +1 -0
  146. package/project.ts +151 -0
  147. package/push.js +401 -0
  148. package/push.js.map +1 -0
  149. package/push.ts +451 -0
  150. package/refs.js +176 -0
  151. package/refs.js.map +1 -0
  152. package/refs.ts +285 -0
  153. package/rewrite.js +176 -0
  154. package/rewrite.js.map +1 -0
  155. package/rewrite.ts +173 -0
  156. package/service.js +104 -0
  157. package/service.js.map +1 -0
  158. package/service.ts +194 -0
  159. package/sha1.js +115 -0
  160. package/sha1.js.map +1 -0
  161. package/sha1.ts +146 -0
  162. package/source.js +100 -0
  163. package/source.js.map +1 -0
  164. package/source.ts +116 -0
  165. package/spare.js +108 -0
  166. package/spare.js.map +1 -0
  167. package/spare.ts +94 -0
  168. package/tools.js +278 -0
  169. package/tools.js.map +1 -0
  170. package/tools.ts +310 -0
  171. package/tree.js +105 -0
  172. package/tree.js.map +1 -0
  173. package/tree.ts +132 -0
  174. package/unpack.js +207 -0
  175. package/unpack.js.map +1 -0
  176. package/unpack.ts +210 -0
  177. package/vocab.js +20 -0
  178. package/vocab.js.map +1 -0
  179. package/vocab.json +386 -0
  180. package/vocab.ts +22 -0
  181. package/workspace.js +449 -0
  182. package/workspace.js.map +1 -0
  183. package/workspace.ts +445 -0
@@ -0,0 +1,6 @@
1
+ /** The two addresses smart HTTP knocks on, under a name wearing `.git`. */ export declare let DOORS: RegExp;
2
+ /** The advertisement asked for at the name's own address, where a clone of
3
+ * the browser's URL begins. */ export declare let BARE: RegExp;
4
+ /** Whether a path is one a clone knocks on, which a host answers with
5
+ * {@link door} ahead of whatever else it serves there. */ export declare let knocks: (path: string) => boolean;
6
+ //# sourceMappingURL=address.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"address.d.ts","sources":["../address.ts"],"names":[],"mappings":"AAAA,yEAAyE,GACzE,OAAO,YAAI,OAAO,OACkD;AAEpE;6BAC6B,GAC7B,OAAO,YAAI,MAAM,OAAmC;AAKpD;wDACwD,GACxD,OAAO,YAAI,SAAU,MAAM,MAAM,KAAG,OAAO,CACN"}
@@ -0,0 +1,3 @@
1
+ import { type VocabDoc } from "@yaks/vocab/runtime";
2
+ export declare const checkoutDoc: VocabDoc;
3
+ //# sourceMappingURL=checkout_vocab.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkout_vocab.d.ts","sources":["../checkout_vocab.ts"],"names":[],"mappings":"AAIA,SAAe,KAAK,QAAQ,mCAAwC;AAEpE,OAAO,cAAM,aAAa,SAIzB"}
@@ -0,0 +1,48 @@
1
+ import type { Bundle, Eid } from "@yaks/graph";
2
+ import { CITES, type Status } from "@yaks/kernel";
3
+ import type { Vocab } from "@yaks/vocab";
4
+ import { type Run } from "./land.js";
5
+ export { CITES };
6
+ /** @yaks/file's component naming a file, a path in a root. (./tree.ts `FILE`
7
+ * is a tree entry's mode, a different thing, which is why these names live
8
+ * here.) */ export declare let FILE: string;
9
+ /** @yaks/file's component naming the lines of a file an entity sits at, which
10
+ * a citation of some lines points at. */ export declare let LINES: string;
11
+ /** The component a file's root wears when Git answers for its files. */ export declare let REPOSITORY: string;
12
+ /** The component naming the commit a citation was last checked against. */ export declare let REVISION: string;
13
+ /** @yaks/code's component for an exported definition, named here because a
14
+ * citation may point at one. */ export declare let SYMBOL: string;
15
+ /** @yaks/kernel's mark, named here because a citation carries one. Only the
16
+ * act of checking writes it, so its absence means nobody has checked. */ export declare let VERIFIED: string;
17
+ /**
18
+ * Where a citation stands. For a file, `changes` names the commits that
19
+ * touched the cited place.
20
+ */ export type { Status };
21
+ /** A checkout to ask Git in: its top directory, and the repository it is a
22
+ * checkout of. A file is checked only in a checkout of its own root. */ export type Checkout = {
23
+ cwd: string;
24
+ repository: Eid;
25
+ };
26
+ /** The checkout for files, and the vocabulary for graph entities. */ export type Ops = {
27
+ checkout?: Checkout;
28
+ run?: Run;
29
+ vocab: Vocab;
30
+ };
31
+ /** The file a cited symbol or place is in, by id: a symbol's module, a place's
32
+ * file. Nothing for a file itself, or for anything that sits in no file. */ export declare let within: (to: Bundle) => Eid | undefined;
33
+ /**
34
+ * The file of a repository a citation of `to` is checked against in Git: `to`
35
+ * itself when it is one, the module a symbol is in, or the file a place is in.
36
+ * Nothing when that file is not in a repository (a file on a volume, the lines
37
+ * of a transcript) or `to` is in no file at all: a citation of those holds to
38
+ * the cited content. `get` answers the file and its root by id.
39
+ */ export declare let tracked: (to: Bundle, get: (eid: Eid) => Bundle | undefined) => Bundle | undefined;
40
+ /**
41
+ * Derive how one citation stands. `cite` is the edge bundle, `to` the bundle
42
+ * it points at, and `file` the file of a repository it is checked against in
43
+ * Git ({@link tracked}), absent for a citation of content. For one whose lines
44
+ * a later commit touched,
45
+ * `status(cite, place, { checkout: { cwd: '/home/me/project', repository }, vocab }, file)`
46
+ * answers `{ state: 'moved', changes: ['b8b0f89'] }`.
47
+ */ export declare let status: (cite: Bundle, to: Bundle, ops: Ops, file?: Bundle) => Promise<Status>;
48
+ //# sourceMappingURL=cites.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cites.d.ts","sources":["../cites.ts"],"names":[],"mappings":"AA+BA,cAAc,MAAM,EAAQ,GAAG,2BAAgC;AAC/D,SAAS,KAAK,EAAE,KAAK,MAAM,4BAAyD;AACpF,cAAc,KAAK,2BAAgC;AACnD,SAAS,KAAK,GAAG,oBAA+B;AAEhD,SAAS,KAAK,GAAE;AAEhB;;UAEU,GACV,OAAO,YAAI,aAAa;AAExB;uCACuC,GACvC,OAAO,YAAI,cAAe;AAE1B,sEAAsE,GACtE,OAAO,YAAI,mBAAyB;AAEpC,yEAAyE,GACzE,OAAO,YAAI,iBAAqB;AAEhC;8BAC8B,GAC9B,OAAO,YAAI,eAAiB;AAE5B;uEACuE,GACvE,OAAO,YAAI,iBAAqB;AAEhC;;;CAGC,GACD,cAAc,MAAM,GAAE;AAEtB;sEACsE,GACtE,YAAY;EAAa,KAAK,MAAM;EAAE,YAAY;;AAElD,mEAAmE,GACnE,YAAY;EACV,WAAW;EACX,MAAM;EACN,OAAO;;AAYT;0EAC0E,GAC1E,OAAO,YAAI,SAAU,IAAI,WAAS,MAAM,SAAS,CAC2B;AAE5E;;;;;;CAMC,GACD,OAAO,YAAI,UACT,IAAI,QACJ,MAAM,KAAK,QAAQ,SAAS,SAAS,KACpC,SAAS,SAAS,CAKpB;AAyBD;;;;;;;CAOC,GACD,OAAO,YAAI,SACT,MAAM,QACN,IAAI,QACJ,KAAK,KACL,OAAO,WACN,QAAQ,QA4DV"}
@@ -0,0 +1,36 @@
1
+ /** One side of a commit's authorship: a name, an email address, and a time.
2
+ * `at` is anything the `Date` constructor accepts — an ISO string read off the
3
+ * graph, or milliseconds since the epoch. */ export type Who = {
4
+ name: string;
5
+ email: string;
6
+ at: string | number | Date;
7
+ };
8
+ /** The contents of a commit, with every id under one hash algorithm. */ export type Commit = {
9
+ /** the root tree's id */ tree: string;
10
+ /** the commits this one follows, in order */ parents?: string[];
11
+ /** who wrote the change */ author: Who;
12
+ /** who recorded it — for yaks.app, the platform itself */ committer: Who;
13
+ /** the message, newline-terminated on the way out */ message: string;
14
+ /** application metadata, stored in the commit header */ headers?: Record<string, string>;
15
+ };
16
+ /** Whole seconds since the epoch — the clock Git records. */ export declare let seconds: (at: Who['at']) => number;
17
+ /** One authorship line's value: `name <email> 1757000000 +0000`. */ export declare let signature: (who: Who) => string;
18
+ /**
19
+ * The tree a commit body names, or nothing if these bytes are not a commit.
20
+ *
21
+ * This is the one link in this package that no edge carries. A commit's
22
+ * parents are rows (./comp.ts) because history is walked constantly, but its
23
+ * tree is recorded only here, in the first line of the body the object id was
24
+ * taken over — and packing reads that body anyway on its way out.
25
+ */ export declare let treeOf: (body: Uint8Array) => string | undefined;
26
+ /** A commit object's body. */ export declare let commitBody: (c: Commit) => Uint8Array<ArrayBuffer>;
27
+ /** Read the tree, ordered parents and complete message of a pushed commit. */ export declare let commitParts: (bytes: Uint8Array) => {
28
+ tree: string;
29
+ parents: string[];
30
+ message: string;
31
+ };
32
+ /** Translate only the object IDs in the header. The message can contain arbitrary bytes. */ export declare let compatibleCommit: (bytes: Uint8Array, named: (id: string) => string) => Uint8Array<ArrayBuffer>;
33
+ /** Keep the author's bytes and message when projecting a commit onto an app. */ export declare let projectedCommit: (bytes: Uint8Array, tree: string, parent: string | null, repository: string) => Uint8Array<ArrayBuffer>;
34
+ /** Change the graph links of a commit while keeping its authorship and message.
35
+ * A signature over the old body cannot sign the rewritten commit. */ export declare let rewrittenCommit: (bytes: Uint8Array, tree: string, parents: string[]) => Uint8Array<ArrayBuffer>;
36
+ //# sourceMappingURL=commit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commit.d.ts","sources":["../commit.ts"],"names":[],"mappings":"AAsBA;;2CAE2C,GAC3C,YAAY;EAAQ,MAAM,MAAM;EAAE,OAAO,MAAM;EAAE,IAAI,MAAM,GAAG,MAAM,GAAG;;AAEvE,sEAAsE,GACtE,YAAY;EACV,uBAAuB,GACvB,MAAM,MAAM;EACZ,2CAA2C,GAC3C,UAAU,MAAM;EAChB,yBAAyB,GACzB,QAAQ;EACR,wDAAwD,GACxD,WAAW;EACX,mDAAmD,GACnD,SAAS,MAAM;EACf,sDAAsD,GACtD,UAAU,OAAO,MAAM,EAAE,MAAM;;AAUjC,2DAA2D,GAC3D,OAAO,YAAI,UAAW,IAAI,IAAI,UAAQ,MAAM,CACD;AAE3C,kEAAkE,GAClE,OAAO,YAAI,YAAa,KAAK,QAAM,MAAM,CAC4B;AAErE;;;;;;;CAOC,GACD,OAAO,YAAI,SAAU,MAAM,eAAa,MAAM,GAAG,SAAS,CAKzD;AAED,4BAA4B,GAC5B,OAAO,YAAI,aAAc,GAAG,WAAS,WAAW,aAgB/C;AAED,4EAA4E,GAC5E,OAAO,YAAI,cACT,OAAO;EACJ,MAAM,MAAM;EAAE,SAAS,MAAM;EAAI,SAAS,MAAM;EAepD;AAED,0FAA0F,GAC1F,OAAO,YAAI,mBACT,OAAO,YACP,QAAQ,IAAI,MAAM,KAAK,MAAM,KAC5B,WAAW,aAYb;AAED,8EAA8E,GAC9E,OAAO,YAAI,kBACT,OAAO,YACP,MAAM,MAAM,EACZ,QAAQ,MAAM,GAAG,IAAI,EACrB,YAAY,MAAM,KACjB,WAAW,aAkBb;AAED;mEACmE,GACnE,OAAO,YAAI,kBACT,OAAO,YACP,MAAM,MAAM,EACZ,SAAS,MAAM,OACd,WAAW,aAoBb"}
@@ -0,0 +1,29 @@
1
+ import type { Eid } from "@yaks/graph";
2
+ import { type VocabDoc } from "@yaks/vocab/runtime";
3
+ /** The component naming a Git object: what it is, and how long its body is. */ export declare let GITOBJ: string;
4
+ /** The component naming where an object's bytes are. */ export declare let BLOB: string;
5
+ /** The relation tag on a tree's link to a child. Named with Git's own two
6
+ * words for it, because `entry` on its own is a transcript line in
7
+ * @yaks/session. */ export declare let TREE_ENTRY: string;
8
+ /** The relation tag on a commit's link to the commit it follows. */ export declare let PARENT: string;
9
+ /** The key kind an object's SHA-256 object id is stored under. Git calls an
10
+ * object's id under the other hash function its compat oid. */ export declare let COMPAT: string;
11
+ /** The component recording where one branch of one repository points. */ export declare let REF: string;
12
+ /**
13
+ * The entity id of a ref, derived from the string `ref|<app>|<name>`.
14
+ *
15
+ * Derived rather than freshly generated, so writing where a branch points is
16
+ * idempotent from anywhere: the hook that saw the release and the sweep that
17
+ * missed it update the same row.
18
+ */ export declare let refEid: (app: Eid, name: string) => Eid;
19
+ /**
20
+ * This package's components as a vocabulary document, to load beside
21
+ * @yaks/edge's and @yaks/key's:
22
+ * `loadVocab([edgeDoc, keyDoc, gitDoc], [edgeKeywords, keyKeywords])`.
23
+ */ export declare let gitDoc: VocabDoc;
24
+ /**
25
+ * The `ref` component alone, for the graph that keeps a repository's branches
26
+ * when that is not the graph its objects are in. It is the same declaration,
27
+ * so the name means one thing in both.
28
+ */ export declare let refDoc: VocabDoc;
29
+ //# sourceMappingURL=comp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"comp.d.ts","sources":["../comp.ts"],"names":[],"mappings":"AAyDA,cAAc,GAAG,2BAAgC;AAEjD,SAAe,KAAK,QAAQ,mCAAwC;AAGpE,6EAA6E,GAC7E,OAAO,YAAI,eAAiB;AAE5B,sDAAsD,GACtD,OAAO,YAAI,aAAa;AAExB;;kBAEkB,GAClB,OAAO,YAAI,mBAAyB;AAEpC,kEAAkE,GAClE,OAAO,YAAI,eAAiB;AAE5B;6DAC6D,GAC7D,OAAO,YAAI,eAAiB;AAE5B,uEAAuE,GACvE,OAAO,YAAI,YAAW;AAEtB;;;;;;CAMC,GACD,OAAO,YAAI,SAAU,KAAK,KAAK,MAAM,MAAM,KAAG,IACT;AAOrC;;;;CAIC,GACD,OAAO,YAAI,QAAQ,SAAc;AAEjC;;;;CAIC,GACD,OAAO,YAAI,QAAQ,SAAgC"}
@@ -0,0 +1,29 @@
1
+ import { type Refs } from "./http.js";
2
+ import type { Objects } from "./objects.js";
3
+ import type { Receiver } from "./push.js";
4
+ export { BARE, DOORS, knocks } from "./address.js";
5
+ /** A repository a request may be answered from: its refs and its objects. */ export type Repository = {
6
+ refs: Refs;
7
+ objects: Objects;
8
+ };
9
+ /** A repository as its host found it for one request. */ export type Found = Repository & {
10
+ /** whether this request may read it */ reads: boolean;
11
+ /** whether the request proved who sent it, which makes a refusal final */ proven: boolean;
12
+ receive?: Receiver;
13
+ };
14
+ /** What a door is given by its host. */ export type Host = {
15
+ /** The repository called `name`, as `req` may see it, or null where there
16
+ * is none. `password` is what a Basic credential carried, the one scheme
17
+ * git offers once challenged; null where the request carried none. */ find: (name: string, req: Request, password: string | null) => Promise<Found | null>;
18
+ /** what git prints above its password prompt */ realm: string;
19
+ failed?: (reason: unknown) => void;
20
+ /** Keeps `work` running after the answer is sent (a Worker's
21
+ * `waitUntil`), and hears its failure: what a push will read, read while
22
+ * its client packs. */ hold?: (work: Promise<void>) => void;
23
+ };
24
+ /** The password of a request's Basic credential. Its username is whatever
25
+ * the person typed in front of it, which a token that says whose it is makes
26
+ * decoration. */ export declare let password: (req: Request) => string | null;
27
+ /** The door: a `Response` for a repository's address, `null` for any other,
28
+ * which its host answers as it would without one. */ export declare let door: (host: Host) => any;
29
+ //# sourceMappingURL=door.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"door.d.ts","sources":["../door.ts"],"names":[],"mappings":"AAuBA,SAAoB,KAAK,IAAI,oBAAwC;AACrE,cAAc,OAAO,uBAAsB;AAG3C,cAAc,QAAQ,oBAAmB;AAEzC,SAAS,IAAI,EAAE,KAAK,EAAE,MAAM,uBAAsB;AAElD,2EAA2E,GAC3E,YAAY;EAAe,MAAM;EAAM,SAAS;;AAEhD,uDAAuD,GACvD,YAAY,QAAQ;EAClB,qCAAqC,GACrC,OAAO,OAAO;EACd,wEAAwE,GACxE,QAAQ,OAAO;EACf,UAAU;;AAGZ,sCAAsC,GACtC,YAAY;EACV;;sEAEoE,GACpE,OACE,MAAM,MAAM,EACZ,KAAK,SACL,UAAU,MAAM,GAAG,IAAI,KACpB,QAAQ,QAAQ,IAAI;EACzB,8CAA8C,GAC9C,OAAO,MAAM;EACb,UAAU,QAAQ,OAAO,KAAK,IAAI;EAClC;;uBAEqB,GACrB,QAAQ,MAAM,QAAQ,IAAI,MAAM,IAAI;;AAetC;;eAEe,GACf,OAAO,YAAI,WAAY,KAAK,YAAU,MAAM,GAAG,IAAI,CAWlD;AAYD;mDACmD,GACnD,OAAO,YAAI,OACR,MAAM,aAsCN"}
@@ -0,0 +1,2 @@
1
+ export declare let formatting: (files: string[], config: unknown, file?: string) => string[];
2
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sources":["../format.ts"],"names":[],"mappings":"AAeA,OAAO,YAAI,aACT,OAAO,MAAM,IACb,QAAQ,OAAO,EACf,kBACC,MAAM,GAYR"}
@@ -0,0 +1,6 @@
1
+ /** Hold the land lock of the checkout whose Git directory is `gitdir` until
2
+ * the returned release: exclusive for the landing that writes the checkout,
3
+ * shared for a reader that needs it whole. Git's own `index.lock` refuses a
4
+ * second writer instead of waiting for it, so whatever writes the shared
5
+ * checkout's index waits here first. */ export declare let hold: (gitdir: string, exclusive: boolean) => Promise<() => void>;
6
+ //# sourceMappingURL=hold.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hold.d.ts","sources":["../hold.ts"],"names":[],"mappings":"AAKA;;;;sCAIsC,GACtC,OAAO,YAAI,OACT,QAAQ,MAAM,EACd,WAAW,OAAO,KACjB,cAAc,IAAI,EAOpB"}
@@ -0,0 +1,126 @@
1
+ import type { Bundle, Graph } from "@yaks/graph";
2
+ export { filesystemEid, localFilesystem } from "./placement.js";
3
+ export { checkoutDoc } from "./checkout_vocab.js";
4
+ /** The entity id of a repository: its declared identity, the canonical common
5
+ * Git directory. */ export declare let repositoryEid: (common: string, workspace: string) => string;
6
+ /** The entity id of a checkout, derived from its repository and its canonical
7
+ * root path. */ export declare let worktreeEid: (repository: string, path: string) => string;
8
+ /** Canonical Git directories for the checkout containing `cwd`, or nothing
9
+ * when that directory is gone or is not a checkout. Other filesystem and
10
+ * subprocess failures remain errors. This observation writes no graph rows. */ export declare let locate: (cwd: string) => Promise<{
11
+ path: string;
12
+ common: string;
13
+ gitdir: string;
14
+ } | undefined>;
15
+ /** Current primary checkouts on this filesystem. Historical observations and
16
+ * managed restore records do not stand in for a checkout that Git can open. */ export declare let primary: (g: Graph) => Promise<string[]>;
17
+ /** Retire obsolete unmanaged checkout observations of the repository at
18
+ * `common`, keeping the entity and its other components. Managed rows retain
19
+ * the history required by restore, and are not read: a repository keeps
20
+ * thousands. */ export declare let reconcile: (g: Graph, common: string, repository: string) => Promise<void>;
21
+ /** Find the checkout containing `cwd`, and update the repository's refs from
22
+ * Git. A ref that Git no longer has keeps its row, marked absent. With
23
+ * `refs: false`, only the checkout's own row: a pass over many checkouts of
24
+ * one repository would otherwise read and compare every ref it has (a
25
+ * thousand and more) once for each. */ export declare let discover: (g: Graph, cwd: string, o?: {
26
+ refs?: boolean;
27
+ }) => Promise<Bundle>;
28
+ /** Repeating the same base request uses its original commit, even after a
29
+ * branch moves. A different base must still name that pinned commit. With
30
+ * `spare`, the checkout is made from the spare beside it ({@link keepSpare}) when
31
+ * there is one. */ export type CheckoutRequest = {
32
+ path: string;
33
+ base?: string;
34
+ branch?: string;
35
+ spare?: boolean;
36
+ };
37
+ /** The checkout containing `cwd`, or undefined when `cwd` is not inside one.
38
+ * Creating a worktree always goes through `discover`, which refuses that. */ export declare let checkoutAt: (g: Graph, cwd: string) => Promise<Bundle | undefined>;
39
+ export declare let createWorktree: (g: Graph, source: string, request: CheckoutRequest) => Promise<Bundle>;
40
+ /**
41
+ * Cut the spare checkout beside `path` from `base` (a commit or ref of the
42
+ * repository `source` is a checkout of), unless one is there: a checkout
43
+ * created in that directory with `spare` is made from it in about a second,
44
+ * where one cut whole writes every file and installs its dependencies. It is
45
+ * cut under a name of its own and moved once whole, so nothing takes it half
46
+ * made. Its Git registration stays locked through publication and claim; a
47
+ * concurrent prune cannot remove it. Unfinished cuts are removed first.
48
+ *
49
+ * ```ts ignore
50
+ * import { createWorktree, keepSpare } from '@yaks/git/host'
51
+ *
52
+ * let path = '/srv/runs/S-1'
53
+ * await createWorktree(graph, '/srv/repo', { path, branch: 'b', spare: true })
54
+ * await keepSpare('/srv/repo', path, 'refs/heads/main') // for the next one
55
+ * ```
56
+ */ export declare let keepSpare: (source: string, path: string, base?: string) => Promise<void>;
57
+ /** Why a worktree was kept: uncommitted files, commits that exist nowhere
58
+ * else, an unfinished Git operation or lock, a failed removal, or a run
59
+ * that took it up again. */ export type Held = 'dirty' | 'unlanded' | 'busy' | 'failed' | 'taken';
60
+ /** What the scan reads of this host's processes, each read failing as procfs
61
+ * does: `procfs` reads Linux's, and a test hands the scan its own. */ export type Procs = {
62
+ /** Every process listed, by pid. */ pids: () => Promise<string[]>;
63
+ /** The uid that owns a process. */ owner: (pid: string) => Promise<number>;
64
+ /** A process's canonical working directory. */ cwd: (pid: string) => Promise<string>;
65
+ /** Where a process's open descriptors point; one that closed reads `''`. */ links: (pid: string) => Promise<string[]>;
66
+ /** The cwd and absolute open file paths of each same-user process ptrace
67
+ * hides, keyed by PID. Processes that cannot be read are absent. */ privileged: (pids: string[]) => Promise<Record<string, string[]>>;
68
+ };
69
+ /** This Linux host's processes, read from `/proc`. */ export declare let procfs: Procs;
70
+ /** Canonical directories occupied by this user's live local processes,
71
+ * including agents outside the graph. A process that cannot be read holds
72
+ * nothing. */ export declare let processCwds: () => Promise<Set<string>>;
73
+ /** Paths occupied by this user's processes: their directories and open files.
74
+ * Procfs links name the canonical file even when it was opened through a
75
+ * symlink. A process that cannot be read holds nothing. */ export declare let processPaths: () => Promise<Set<string>>;
76
+ /** A process using any path inside a worktree keeps the whole checkout. */ export declare let inUse: (path: string, cwds: Set<string>) => boolean;
77
+ /** A worktree Git has already lost: the gitdir its `.git` file names is gone,
78
+ * so nothing can be committed from it and nothing read out of it. */ export declare let lost: (path: string) => Promise<boolean>;
79
+ /** When a reflog's last entry moved HEAD, in milliseconds: the time written
80
+ * in the entry, not the file's. `git gc` expires every worktree's reflog,
81
+ * rewriting each file whole with the same entries, so its mtime says when
82
+ * gc last ran. */ export declare let moved: (reflog: string) => number;
83
+ /** How long, in milliseconds, since Git last moved this linked worktree's
84
+ * HEAD: a commit, checkout, rebase or reset, by its reflog's last entry, or
85
+ * HEAD's own write. Editing or staging a file moves neither, but it makes the
86
+ * worktree dirty, and a dirty worktree is kept at any age. Zero for anything
87
+ * that is not a linked worktree. */ export declare let idleFor: (path: string, now?: number) => Promise<number>;
88
+ /** The linked worktrees of the repository whose common Git directory is
89
+ * `common`: every checkout `git worktree list` names but the primary one.
90
+ * Git's records of worktrees whose directory is already gone are pruned
91
+ * first, so none of those is named. */ export declare let linked: (common: string) => Promise<string[]>;
92
+ /** What this worktree still holds, `undefined` when it holds nothing: a clean
93
+ * working tree whose HEAD already exists on some other branch — the base it was
94
+ * created from, a parent's branch, main. Its own branch never counts; that is
95
+ * what "unlanded" means. A path that is not a worktree at all is reported as
96
+ * `unlanded` — kept, never guessed at. With `landed`, only that full local
97
+ * branch ref counts as a landing (for example `refs/heads/main`), and the
98
+ * branch reflog must prove it committed work still contained in HEAD. A fresh
99
+ * branch or missing reflog evidence is kept. A lock or unfinished Git
100
+ * operation keeps a linked worktree as `busy`. A caller supplying the checkout's
101
+ * pinned `base` can also take back a clean checkout still at that commit. */ export declare let holds: (path: string, landed?: string, base?: string) => Promise<Held | undefined>;
102
+ /** Remove one worktree — the directory and the branch it was created on —
103
+ * unless it still holds something. Returns what kept it, or nothing. A worktree
104
+ * Git has lost is kept: its unique contents cannot be proved absent. Nothing
105
+ * here passes `--force`, so Git's own
106
+ * refusal is a second guard behind `holds`. It is removed under the lock
107
+ * creation takes at its path, after `free` (asked under that lock) says
108
+ * nobody took it up again: a checkout created there meanwhile waits for the
109
+ * removal to finish and cuts it again, rather than finding it half gone. */ export declare let reclaim: (path: string, landed?: string, base?: string, free?: () => Promise<boolean>) => Promise<Held | undefined>;
110
+ /** The size of an untracked file too large to commit when shelving: a
111
+ * megabyte. A checkout holding one is kept, as an asset never goes in Git. */ export declare let LARGE: number;
112
+ /** Put a worktree its agent left on its shelf: its uncommitted files are
113
+ * committed onto its branch, a detached HEAD gets a `shelf/` branch of its
114
+ * own, and the checkout is removed while the branch stays. Every commit stays
115
+ * on a branch, so `restore` cuts it again where it stood once `onBranch` (run
116
+ * with the work committed and the checkout still there) has recorded it.
117
+ * Returns what kept it, or nothing: `dirty` for an untracked file of
118
+ * {@link LARGE} or more, `busy` for a lock or unfinished Git operation,
119
+ * `failed` when Git refused a step. It is removed
120
+ * under the lock creation takes at its path, as `reclaim` removes one. */ export declare let shelve: (path: string, onBranch?: () => Promise<unknown>, free?: () => Promise<boolean>) => Promise<Held | undefined>;
121
+ /** The path this worktree is checked out at, creating it again if it was
122
+ * removed — same path, same branch, at the commit its row recorded — so work
123
+ * taken back by `reclaim` comes back where it stood. Nothing new has to be
124
+ * recorded for that: `workspace{root}` and `worktree{head, branch}` already holds it, as long
125
+ * as `discover` brought it up to date before the files went. */ export declare let restore: (g: Graph, tree: Bundle) => Promise<string>;
126
+ //# sourceMappingURL=host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host.d.ts","sources":["../host.ts"],"names":[],"mappings":"AAeA,cAAc,MAAM,EAAQ,KAAK,2BAAgC;AASjE,SAAS,aAA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,OAAO,SAAS,EAK1B;AAmDD;;;;8DAI8D,GAC9D,OAAO,YAAI,UAAiB,GAAG,OAAO,MAAM,WAAS,QAAQ,MAAM,EAuBlE"}
@@ -0,0 +1,33 @@
1
+ import type { Objects } from "./objects.js";
2
+ /** One ref: its full name, and the object it points at. */ export type Ref = {
3
+ name: string;
4
+ oid: string;
5
+ };
6
+ /** A repository's refs, in the form these handlers need them. */ export type Refs = {
7
+ /** every ref, by full name: `refs/heads/main`, not `main` */ list: () => Promise<Ref[]>;
8
+ /** the ref HEAD symbolically points at; `refs/heads/main` by default */ head?: string;
9
+ };
10
+ /** What HEAD points at when a repository does not say otherwise. */ export declare let MAIN: string;
11
+ export declare let DRAFT: string;
12
+ /**
13
+ * What this server supports, in the order Git writes it. `agent` is a courtesy
14
+ * line every implementation sends; the rest is the contract.
15
+ */ export declare let CAPS: string[];
16
+ /** The one service served: a clone's and a fetch's. */ export declare let SERVICE: string;
17
+ export declare let RECEIVE: string;
18
+ /**
19
+ * The response to `GET <repo>/info/refs?service=git-upload-pack`: the service
20
+ * line smart HTTP opens with, then {@link CAPS}.
21
+ *
22
+ * It has no refs parameter, because a version 2 advertisement carries no refs
23
+ * — that is the point of version 2, and `ls-refs` is where a client asks for
24
+ * them.
25
+ */ export declare let advertise: (req: Request) => Response;
26
+ /**
27
+ * The response to `POST <repo>/git-upload-pack`: one command in, one response
28
+ * out.
29
+ *
30
+ * The caller has already decided that this repository may be read
31
+ * (./door.ts).
32
+ */ export declare let uploadPack: (req: Request, refs: Refs, from: Objects, failed?: (reason: unknown) => void) => Promise<Response>;
33
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sources":["../http.ts"],"names":[],"mappings":"AAmCA,cAAc,OAAO,uBAAsB;AAI3C,yDAAyD,GACzD,YAAY;EAAQ,MAAM,MAAM;EAAE,KAAK,MAAM;;AAE7C,+DAA+D,GAC/D,YAAY;EACV,2DAA2D,GAC3D,YAAY,QAAQ;EACpB,sEAAsE,GACtE,OAAO,MAAM;;AAGf,kEAAkE,GAClE,OAAO,YAAI,aAAwB;AACnC,OAAO,YAAI,cAA0B;AAErC;;;CAGC,GACD,OAAO,YAAI,MAAM,MAAM,GAOtB;AAED,qDAAqD,GACrD,OAAO,YAAI,gBAA2B;AAEtC,OAAO,YAAI,gBAA4B;AAyBvC;;;;;;;CAOC,GACD,OAAO,YAAI,YAAa,KAAK,YAAU,SActC;AA4LD;;;;;;CAMC,GACD,OAAO,YAAI,aACT,KAAK,SACL,MAAM,MACN,MAAM,SACN,UAAU,QAAQ,OAAO,KAAK,IAAI,KACjC,QAAQ,UAWV"}
@@ -0,0 +1,13 @@
1
+ import { type Carried } from "./index.js";
2
+ import { type Kind } from "./oid.js";
3
+ import type { Obj } from "./pack.js";
4
+ import { type Repo } from "./refs.js";
5
+ /** Keep the new objects reachable from the pushed tip, bottom up. `kind`
6
+ * checks repository-local objects the pack omitted. Returns incoming files
7
+ * by their content address for callers that also publish the snapshot. */ export declare let importPush: (repo: Pick<Repo, 'objects' | 'bytes'>, tip: string, pushed: Map<string, Obj>, kind: (id: string) => Promise<Kind | undefined>) => Promise<Map<string, Uint8Array<ArrayBuffer>>>;
8
+ /** A push's objects in hand, as @yaks/git/index `listTrees` reads them before
9
+ * they are stored: each blob's address (the SHA-256 its bytes are kept under)
10
+ * by its id, and its bytes by that address. */ export declare let carriedOf: (pushed: ReadonlyMap<string, Obj>) => Carried & {
11
+ bytes: Map<string, Uint8Array<ArrayBuffer>>;
12
+ };
13
+ //# sourceMappingURL=import.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import.d.ts","sources":["../import.ts"],"names":[],"mappings":"AAGA,SAAS,KAAK,OAAO,qBAA2B;AAChD,SAAS,KAAK,IAAI,mBAA6B;AAC/C,cAAc,GAAG,oBAAmB;AACpC,SAAoB,KAAK,IAAI,oBAAmB;AAsChD;;wEAEwE,GACxE,OAAO,YAAI,aACT,MAAM,KAAK,MAAM,YAAY,UAC7B,KAAK,MAAM,EACX,QAAQ,IAAI,MAAM,EAAE,MACpB,OAAO,IAAI,MAAM,KAAK,QAAQ,OAAO,SAAS,MAC7C,QAAQ,IAAI,MAAM,EAAE,WAAW,eAoDjC;AAOD;;6CAE6C,GAC7C,OAAO,YAAI,YACT,QAAQ,YAAY,MAAM,EAAE,SAC3B;EAAY,OAAO,IAAI,MAAM,EAAE,WAAW;EAW5C"}
@@ -0,0 +1,80 @@
1
+ import { type Blobs } from "@yaks/blob";
2
+ import type { Eid, Graph } from "@yaks/graph";
3
+ import { type Commit } from "./commit.js";
4
+ import type { Obj } from "./pack.js";
5
+ import { type Oids } from "./oid.js";
6
+ import { type Files } from "./tree.js";
7
+ /** One child of a tree, named both ways. */ export type Child = {
8
+ name: string;
9
+ mode: string;
10
+ } & Oids;
11
+ /** A commit to write: the same as a {@link Commit}, but with every id given
12
+ * under both hash algorithms, since the two bodies are built from the two. */ export type Mint = Omit<Commit, 'tree' | 'parents'> & {
13
+ tree: Oids;
14
+ parents?: Oids[];
15
+ };
16
+ /**
17
+ * What writing objects needs from a graph: a read and an apply, nothing else.
18
+ *
19
+ * Narrower than `Graph` on purpose. The object index is the same code whether
20
+ * the graph is in this process or behind an HTTP API — a Durable Object's
21
+ * `/query` and `/apply` endpoints satisfy both of these — and a parameter that
22
+ * demanded a whole `Graph` would have forced a remote caller to invent a
23
+ * storage layer and a vocabulary it has no use for.
24
+ */ export type Writes = Pick<Graph, 'read' | 'apply'>;
25
+ /** Writing objects into one graph and one byte store. */ export type Index = {
26
+ /** Keep a received object with its exact SHA-1 body and translated links. */ receive: (object: Obj, children: Map<string, Oids>) => Promise<Oids>;
27
+ /** the git blob object over bytes the store already holds */ blob: (sha: string) => Promise<Oids>;
28
+ /** a tree over children already written */ tree: (children: Child[]) => Promise<Oids>;
29
+ /** The entries of an existing tree, with both object IDs. */ children: (tree: Oids) => Promise<Child[]>;
30
+ /** a commit over a tree and parents already written */ commit: (mint: Mint) => Promise<Oids>;
31
+ /** a whole deploy manifest, bottom up: every blob, every directory, and the
32
+ * root tree it returns. Given the commit before it (`base`), only what
33
+ * moved since is read or written. */ files: (manifest: Files, base?: Base) => Promise<Oids>;
34
+ };
35
+ /** The commit a manifest follows: its tree, and the manifest that tree was
36
+ * made from. The tree may still be on its way, none where it could not be
37
+ * read: the files that moved since are named while it comes. */ export type Base = {
38
+ tree: Oids | Promise<Oids | undefined>;
39
+ files: Files;
40
+ };
41
+ /** Resolve a Git commit to its root tree. */ export declare let commitTree: (g: Pick<Writes, 'read'>, bytes: Blobs, commit: string) => Promise<string>;
42
+ /** List the files below a tree, without reading any file bodies. */ export declare let listFiles: (g: Pick<Writes, 'read'>, bytes: Blobs, tree: string) => Promise<Files>;
43
+ /** Objects a caller holds in hand (a push's), with each blob's address, the
44
+ * name its bytes are kept under (`carriedOf`). */ export type Carried = {
45
+ objects: ReadonlyMap<string, Obj>;
46
+ addresses: ReadonlyMap<string, string>;
47
+ };
48
+ /** The files below each of several trees, without reading any file bodies.
49
+ * The trees are walked together, a level at a time, so a directory or file
50
+ * they share is read once: an app's versions share most of theirs, and twenty
51
+ * of them cost about what one does. An object `carried` holds is read from
52
+ * there and not the graph, so a pushed tree lists before it is stored. */ export declare let listTrees: (g: Pick<Writes, 'read'>, bytes: Blobs, trees: string[], carried?: Carried) => Promise<Map<string, Files>>;
53
+ /**
54
+ * Each object's SHA-256 id by its SHA-1 id, for those of `oids` the graph
55
+ * holds: the compat keys off them, a hundred at a time. Asked by the key's
56
+ * own index on `key.of`, so it reads one row per object named.
57
+ */ export declare let names: (g: Pick<Writes, 'read'>, oids: string[]) => Promise<Map<string, string>>;
58
+ /**
59
+ * The entity id of a retained tree link to one child, derived from the string
60
+ * `tree_entry|<tree>|<name>`.
61
+ *
62
+ * Not @yaks/edge's own derivation, for a reason a duplicate file makes
63
+ * obvious: two names in one tree may point at one blob (two empty files, say),
64
+ * and `from|relation|to` is the same string for both, so one link would
65
+ * overwrite the other. Within a tree it is the name that is unique, so the
66
+ * name is what the id is derived from.
67
+ */ export declare let entryEid: (tree: Eid, name: string) => Eid;
68
+ /**
69
+ * An object index over a graph that carries this package's components and a
70
+ * @yaks/blob store that holds the bytes.
71
+ *
72
+ * ```ts
73
+ * // let git = index(g, store)
74
+ * // let tree = await git.files({ 'index.html': sha })
75
+ * // let head = await git.commit({ tree, author, committer, message: 'deploy 1' })
76
+ * ```
77
+ */ export declare let index: (g: Writes, store: Blobs, buffered?: boolean) => Index & {
78
+ flush: () => Promise<void>;
79
+ };
80
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sources":["../index.ts"],"names":[],"mappings":"AAiCA,SAAS,KAAK,KAAK,0BAAuC;AAE1D,cAA4B,GAAG,EAAE,KAAK,2BAAgC;AAKtE,SACE,KAAK,MAAM,sBAKO;AAEpB,cAAc,GAAG,oBAAmB;AAEpC,SAQE,KAAK,IAAI,mBACM;AACjB,SAIE,KAAK,KAAK,oBAIM;AAElB,0CAA0C,GAC1C,YAAY;EAAU,MAAM,MAAM;EAAE,MAAM,MAAM;IAAK;AAErD;4EAC4E,GAC5E,YAAY,OAAO,KAAK,QAAQ,SAAS;EACvC,MAAM;EACN,UAAU;;AAGZ;;;;;;;;CAQC,GACD,YAAY,SAAS,KAAK,OAAO,SAAS;AAE1C,uDAAuD,GACvD,YAAY;EACV,2EAA2E,GAC3E,UAAU,QAAQ,KAAK,UAAU,IAAI,MAAM,EAAE,UAAU,QAAQ;EAC/D,2DAA2D,GAC3D,OAAO,KAAK,MAAM,KAAK,QAAQ;EAC/B,yCAAyC,GACzC,OAAO,UAAU,YAAY,QAAQ;EACrC,2DAA2D,GAC3D,WAAW,MAAM,SAAS,QAAQ;EAClC,qDAAqD,GACrD,SAAS,MAAM,SAAS,QAAQ;EAChC;;qCAEmC,GACnC,QAAQ,UAAU,OAAO,OAAO,SAAS,QAAQ;;AAGnD;;8DAE8D,GAC9D,YAAY;EAAS,MAAM,OAAO,QAAQ,OAAO,SAAS;EAAG,OAAO;;AAEpE,2CAA2C,GAC3C,OAAO,YAAI,aACT,GAAG,KAAK,QAAQ,SAChB,OAAO,OACP,QAAQ,MAAM,KACb,QAAQ,MAAM,EAShB;AAED,kEAAkE,GAClE,OAAO,YAAI,YACT,GAAG,KAAK,QAAQ,SAChB,OAAO,OACP,MAAM,MAAM,KACX,QAAQ,OAAwD;AAEnE;gDACgD,GAChD,YAAY;EACV,SAAS,YAAY,MAAM,EAAE;EAC7B,WAAW,YAAY,MAAM,EAAE,MAAM;;AAGvC;;;;wEAIwE,GACxE,OAAO,YAAI,YACT,GAAG,KAAK,QAAQ,SAChB,OAAO,OACP,OAAO,MAAM,IACb,UAAU,YACT,QAAQ,IAAI,MAAM,EAAE,QAoDtB;AAED;;;;CAIC,GACD,OAAO,YAAI,QACT,GAAG,KAAK,QAAQ,SAChB,MAAM,MAAM,OACX,QAAQ,IAAI,MAAM,EAAE,MAAM,GAW5B;AAYD;;;;;;;;;CASC,GACD,OAAO,YAAI,WAAY,MAAM,KAAK,MAAM,MAAM,KAAG,IACJ;AAc7C;;;;;;;;;CASC,GACD,OAAO,YAAI,QACT,GAAG,QACH,OAAO,OACP,uBACC;EAAU,aAAa,QAAQ,IAAI;EAwUrC"}
@@ -0,0 +1,77 @@
1
+ export { formatting } from "./format.js";
2
+ import { type Clock } from "@yaks/fp";
3
+ import { CallError } from "@yaks/tools/errors";
4
+ /** One run of git. `out` and `err` are RAW, exactly as Git wrote them — a
5
+ * caller that prints Git's own output must not have it trimmed out from under
6
+ * it (land prints `git diff --stat`, whose first line is indented), so
7
+ * trimming is the reader's job, at the point it wants a value. `ok` is whether
8
+ * Git succeeded and `code` is its exit status: a command like
9
+ * `merge-base --is-ancestor` reports its answer as an exit code, so a failed
10
+ * run is often an answer rather than a fault. */ export type Ran = {
11
+ ok: boolean;
12
+ code: number;
13
+ out: string;
14
+ err: string;
15
+ };
16
+ /** How land runs git. It is a parameter so that a test can answer without a
17
+ * repository. */ export type Run = (args: string[], cwd: string) => Promise<Ran>;
18
+ /** A landing refused for the caller's own state: not in a linked worktree on
19
+ * a branch, a dirty worktree, a revert the guard caught, or commits the base's
20
+ * upstream declined. It is a `CallError`,
21
+ * so whatever tool lands, a refusal reaches its caller as an answer and never
22
+ * as a fault. An unexpected Git command failure is a plain `Error`, a fault
23
+ * somebody has to hear about. */ export declare class LandError extends CallError {
24
+ constructor(message: string);
25
+ }
26
+ /** Run git without a terminal prompt. */ export declare let run: Run;
27
+ /** A commit that landed, with its whole message. */ export type Commit = {
28
+ sha: string;
29
+ message: string;
30
+ };
31
+ /** Commits from `git log --format=%H%x00%B%x01`. */ export declare let commits: (log: string) => Commit[];
32
+ /** Landed carries the merged commit sha, the commits that landed with it, and
33
+ * the shared checkout's path, so the caller can clean up whatever the merge
34
+ * left behind. */ export type Landed = {
35
+ landed: string;
36
+ root: string;
37
+ commits: Commit[];
38
+ };
39
+ /** Diverged means the base moved: the branch has been rebased and is waiting,
40
+ * and `conflict` reports whether that rebase is sitting unresolved for the
41
+ * caller to finish before landing again. */ export type Diverged = {
42
+ diverged: true;
43
+ conflict: boolean;
44
+ };
45
+ export type Outcome = Landed | Diverged;
46
+ /** What a landing takes: which directory to work in, how to run git, where to
47
+ * print, and the files whose rewind has been approved. */ export type LandOps = {
48
+ cwd?: string;
49
+ run?: Run;
50
+ /** Format changed paths; Deno selects file types and honors checkout config. */ format?: Run;
51
+ /** Preserve the source commit and record landing's edits in their own commit. */ formatCommit?: string;
52
+ /** Bring pnpm-lock.yaml up to the checkout at cwd's manifests. */ lock?: (cwd: string) => Promise<Ran>;
53
+ write?: (text: string, error?: boolean) => void;
54
+ /** The writer that owns an automated worktree. */ writer?: string;
55
+ /** files whose rewind is deliberate: warned about, then landed */ allow?: string[];
56
+ /** wait for the shared checkout to be this landing's alone, given its Git
57
+ * directory; the release ends that. {@link hold}, exclusive, by default */ hold?: (gitdir: string) => Promise<() => void>;
58
+ /** where a failure land catches and carries on past is reported: a push
59
+ * the remote refused. The host's telemetry (@yaks/host `report`). */ report?: (error: unknown, context?: {
60
+ tags?: Record<string, string>;
61
+ }) => unknown;
62
+ /** the time a push waits before it tries again; the runtime's by default */ clock?: Clock;
63
+ };
64
+ export type Revert = {
65
+ file: string;
66
+ rewound: boolean;
67
+ };
68
+ /** Every file this landing would change that the branch did not author. Asked
69
+ * only when the base is an ancestor of the branch, so that `base...HEAD` is
70
+ * exactly the landing diff. How it runs git is a parameter, which is how a
71
+ * test answers without a repository. */ export declare let reverts: (ask: (args: string[]) => Promise<string>, base: string) => Promise<Revert[]>;
72
+ /** Every path in raw, NUL-delimited diff records. */ export declare let named: (raw: string) => string[];
73
+ /** Whether a path is one the pnpm lockfile is resolved from. */ export declare let manifest: (path: string) => boolean;
74
+ /** Land the branch you are standing on: fast-forward it into the base, or
75
+ * rebase onto a base that moved and return, for the caller to re-run its tests
76
+ * and land again. */ export declare let land: (ops?: LandOps) => Promise<Outcome>;
77
+ //# sourceMappingURL=land.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"land.d.ts","sources":["../land.ts"],"names":[],"mappings":"AAGA,SAAS,UAAU,sBAAqB;AAkDxC,SAAkB,KAAK,KAAK,wBAAoC;AAChE,SAAS,SAAS,kCAAuC;AAGzD;;;;;;+CAM+C,GAC/C,YAAY;EAAQ,IAAI,OAAO;EAAE,MAAM,MAAM;EAAE,KAAK,MAAM;EAAE,KAAK,MAAM;;AAEvE;eACe,GACf,YAAY,OAAO,MAAM,MAAM,IAAI,KAAK,MAAM,KAAK,QAAQ;AAE3D;;;;;+BAK+B,GAC/B,OAAO,cAAM,kBAAkB;EAC7B,YAAY,SAAS,MAAM;AAI7B;AA0CA,uCAAuC,GACvC,OAAO,YAAI,KAAK,IAA8C;AA2B9D,kDAAkD,GAClD,YAAY;EAAW,KAAK,MAAM;EAAE,SAAS,MAAM;;AAInD,kDAAkD,GAClD,OAAO,YAAI,UAAW,KAAK,MAAM,KAAG,SAIhC;AAEJ;;gBA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