@fungi.computer/oyster 0.57.6 → 0.57.8

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.
@@ -3,9 +3,15 @@ import { Cli } from "@fungi.computer/lantern";
3
3
  import { installStandaloneAppSet } from "./app-set.js";
4
4
  /**
5
5
  * The commit a checkout installs from. A checkout with uncommitted edits is
6
- * the owner's own, so it is recorded as a commit holding those edits (made
7
- * with `git stash create`, which leaves the stash and the tree alone), never
8
- * as the release tag's commit it started from.
6
+ * the owner's own, so it is recorded as a commit holding those edits (the
7
+ * tracked files as they are on disk, plus anything staged), never as the
8
+ * release tag's commit it started from.
9
+ *
10
+ * The edits are captured through a private copy of the index. The command
11
+ * `git stash create` rewrites the checkout's own index, and when another git
12
+ * process (an editor, a file watcher, a second command) holds `index.lock` it
13
+ * exits 1 with no message, which would fail the install for a reason the
14
+ * owner cannot see.
9
15
  */
10
16
  export declare function checkoutRevision(directory: string): string;
11
17
  export declare function installApps(args: readonly string[], install?: typeof installStandaloneAppSet, ui?: Cli): Promise<void>;
@@ -8,6 +8,7 @@
8
8
  // [--repositories <base URL>] [--ref <branch or tag>]
9
9
  // [--from <checkout directory>] [--concurrency 1-3] [--timings <file>] [--only <app>[,<app>]]
10
10
  import { execFileSync } from "node:child_process";
11
+ import { copyFileSync, existsSync, mkdtempSync, rmSync } from "node:fs";
11
12
  import { mkdtemp, rm, writeFile } from "node:fs/promises";
12
13
  import { tmpdir } from "node:os";
13
14
  import { join, resolve } from "node:path";
@@ -46,13 +47,41 @@ Options:
46
47
  `;
47
48
  /**
48
49
  * The commit a checkout installs from. A checkout with uncommitted edits is
49
- * the owner's own, so it is recorded as a commit holding those edits (made
50
- * with `git stash create`, which leaves the stash and the tree alone), never
51
- * as the release tag's commit it started from.
50
+ * the owner's own, so it is recorded as a commit holding those edits (the
51
+ * tracked files as they are on disk, plus anything staged), never as the
52
+ * release tag's commit it started from.
53
+ *
54
+ * The edits are captured through a private copy of the index. The command
55
+ * `git stash create` rewrites the checkout's own index, and when another git
56
+ * process (an editor, a file watcher, a second command) holds `index.lock` it
57
+ * exits 1 with no message, which would fail the install for a reason the
58
+ * owner cannot see.
52
59
  */
53
60
  export function checkoutRevision(directory) {
54
- const git = (...args) => execFileSync("git", args, { cwd: directory, encoding: "utf8" }).trim();
55
- return git("stash", "create") || git("rev-parse", "HEAD");
61
+ const git = (env, ...args) => execFileSync("git", args, {
62
+ cwd: directory,
63
+ encoding: "utf8",
64
+ env: { ...process.env, ...env },
65
+ }).trim();
66
+ const head = git({}, "rev-parse", "HEAD");
67
+ const scratch = mkdtempSync(join(tmpdir(), "oyster-checkout-index-"));
68
+ try {
69
+ const index = join(scratch, "index");
70
+ const realIndex = resolve(directory, git({}, "rev-parse", "--git-path", "index"));
71
+ if (existsSync(realIndex))
72
+ copyFileSync(realIndex, index);
73
+ const env = { GIT_INDEX_FILE: index };
74
+ if (!existsSync(index))
75
+ git(env, "read-tree", "HEAD");
76
+ git(env, "add", "--update");
77
+ const tree = git(env, "write-tree");
78
+ if (tree === git({}, "rev-parse", "HEAD^{tree}"))
79
+ return head;
80
+ return git(env, "commit-tree", tree, "-p", head, "-m", "On HEAD: install-apps checkout");
81
+ }
82
+ finally {
83
+ rmSync(scratch, { recursive: true, force: true });
84
+ }
56
85
  }
57
86
  function missingVariableMessage(url, key) {
58
87
  const lines = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fungi.computer/oyster",
3
- "version": "0.57.6",
3
+ "version": "0.57.8",
4
4
  "author": "Levi <levi@technomancy.dev>",
5
5
  "description": "Oyster by Fungi: open-source Apps for people and AI agents. Try with one command or run on your own Cloudflare account.",
6
6
  "homepage": "https://docs.fungi.computer/oyster",
@@ -362,9 +362,9 @@
362
362
  "dependencies": {
363
363
  "@cfworker/json-schema": "4.1.1",
364
364
  "@earendil-works/pi-ai": "1.5.2",
365
- "@fungi.computer/agar": "0.28.1",
365
+ "@fungi.computer/agar": "0.28.2",
366
366
  "@fungi.computer/bird-dog": "0.3.8",
367
- "@fungi.computer/braid": "0.6.12",
367
+ "@fungi.computer/braid": "0.6.13",
368
368
  "@fungi.computer/burrow": "0.2.1",
369
369
  "@fungi.computer/cairn": "0.1.0",
370
370
  "@fungi.computer/capnweb": "0.12.0-fungi.0",
@@ -372,27 +372,27 @@
372
372
  "@fungi.computer/carrier": "0.2.6",
373
373
  "@fungi.computer/computer": "0.18.5",
374
374
  "@fungi.computer/computer-contract": "0.6.4",
375
- "@fungi.computer/darkroom": "0.11.20",
375
+ "@fungi.computer/darkroom": "0.11.21",
376
376
  "@fungi.computer/ear-tag": "0.2.0",
377
377
  "@fungi.computer/forage": "0.5.2",
378
378
  "@fungi.computer/gills": "0.4.0",
379
379
  "@fungi.computer/knapsack": "0.4.27",
380
380
  "@fungi.computer/lantern": "0.4.2",
381
381
  "@fungi.computer/mycelium": "0.4.12",
382
- "@fungi.computer/nacre": "0.9.5",
383
- "@fungi.computer/parakeet": "0.17.6",
382
+ "@fungi.computer/nacre": "0.9.6",
383
+ "@fungi.computer/parakeet": "0.17.7",
384
384
  "@fungi.computer/puffball": "0.15.0",
385
385
  "@fungi.computer/seam": "0.2.7",
386
- "@fungi.computer/shiitake": "0.22.7",
387
- "@fungi.computer/shiitake-extensions": "0.13.3",
386
+ "@fungi.computer/shiitake": "0.22.8",
387
+ "@fungi.computer/shiitake-extensions": "0.13.4",
388
388
  "@fungi.computer/sigils": "0.3.2",
389
389
  "@fungi.computer/sprite": "0.2.2",
390
390
  "@fungi.computer/sprite-zdog": "0.3.2",
391
391
  "@fungi.computer/veil": "0.11.9",
392
392
  "@fungi.computer/watchdog": "0.1.5",
393
393
  "@fungi.computer/whistle": "0.3.0",
394
- "@fungi.computer/workflows-wire": "0.7.13",
395
- "@fungi.computer/zookeeper": "0.0.66",
394
+ "@fungi.computer/workflows-wire": "0.7.14",
395
+ "@fungi.computer/zookeeper": "0.0.67",
396
396
  "@jellybrick/dbus-next": "0.11.4",
397
397
  "@modelcontextprotocol/server": "2.0.0",
398
398
  "@msgpack/msgpack": "3.1.3",