gestalt-mobile 0.77.1 → 0.78.0

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.
@@ -29,4 +29,9 @@ SPDX-License-Identifier: AGPL-3.0-or-later
29
29
  <symbol id="more" viewBox="0 0 24 24"><circle cx="6" cy="12" r="1.5" /><circle cx="12" cy="12" r="1.5" /><circle cx="18" cy="12" r="1.5" /></symbol>
30
30
  <symbol id="upload" viewBox="0 0 24 24"><path d="M12 16V4m-4 4 4-4 4 4M4 16v4h16v-4" /></symbol>
31
31
  <symbol id="send" viewBox="0 0 24 24"><path d="M9 10 5 14l4 4M5 14h8a6 6 0 0 0 6-6V6" /></symbol>
32
+ <symbol id="document" viewBox="0 0 24 24"><path d="M6 3h8l4 4v14H6z M14 3v5h4 M9 13h6 M9 17h4"/></symbol>
33
+ <symbol id="rename" viewBox="0 0 24 24"><path d="m14 5 5 5 M4 20l5-1 12-12-5-5L4 14z"/></symbol>
34
+ <symbol id="chevron" viewBox="0 0 24 24"><path d="m9 5 7 7-7 7"/></symbol>
35
+ <symbol id="folder-add" viewBox="0 0 24 24"><path d="M3 6h7l2 3h9v11H3z M12 11v7 M8.5 14.5h7"/></symbol>
36
+ <symbol id="move" viewBox="0 0 24 24"><path d="M3 7h7l2 2h9v11H3v-4 M2 12h12 m-4-4 4 4-4 4"/></symbol>
32
37
  </svg>
@@ -16,8 +16,8 @@ SPDX-License-Identifier: AGPL-3.0-or-later
16
16
  <link rel="icon" href="/icons/gestalt-mobile-192.png" />
17
17
  <link rel="apple-touch-icon" href="/icons/gestalt-mobile-180.png" />
18
18
  <title>Gestalt Mobile</title>
19
- <script type="module" crossorigin src="/assets/index-BKy50zl1.js"></script>
20
- <link rel="stylesheet" crossorigin href="/assets/index-lRjK7KYk.css">
19
+ <script type="module" crossorigin src="/assets/index-DDtx1aeG.js"></script>
20
+ <link rel="stylesheet" crossorigin href="/assets/index-D7oz0ApM.css">
21
21
  </head>
22
22
  <body>
23
23
  <div id="app"></div>
@@ -6,6 +6,8 @@ export async function mutation(request, reply, deps, operation) {
6
6
  if (!body ||
7
7
  typeof body.source !== 'string' ||
8
8
  typeof body.destinationDirectory !== 'string' ||
9
+ (body.newName !== undefined &&
10
+ (operation !== 'move' || body.conflict !== 'reject' || typeof body.newName !== 'string')) ||
9
11
  !['reject', 'replace', 'keep-both'].includes(body.conflict ?? ''))
10
12
  return reply.code(400).send({ code: 'INVALID_FILE_MUTATION' });
11
13
  const method = deps.files[operation];
@@ -345,6 +345,14 @@ export class FilesystemWorkspaceFiles {
345
345
  }
346
346
  async transfer(rootPath, input, moving) {
347
347
  if (!validRelative(input.source) ||
348
+ (input.newName !== undefined &&
349
+ (!moving ||
350
+ input.conflict !== 'reject' ||
351
+ typeof input.newName !== 'string' ||
352
+ !input.newName.trim() ||
353
+ !validName(input.newName) ||
354
+ Buffer.byteLength(input.newName) > 255 ||
355
+ dirnameRelative(input.source) !== input.destinationDirectory)) ||
348
356
  (input.destinationDirectory !== '' && !validRelative(input.destinationDirectory)))
349
357
  return { kind: 'invalid-destination' };
350
358
  const root = await this.canonicalDirectory(rootPath);
@@ -366,7 +374,9 @@ export class FilesystemWorkspaceFiles {
366
374
  await Promise.all([sourceParent.close(), parent.close()]);
367
375
  return { kind: 'missing' };
368
376
  }
369
- if (dirnameRelative(input.source) === input.destinationDirectory && moving) {
377
+ if (dirnameRelative(input.source) === input.destinationDirectory &&
378
+ moving &&
379
+ (!input.newName || input.newName === basename(source))) {
370
380
  await Promise.all([sourceParent.close(), parent.close()]);
371
381
  return { kind: 'same-parent' };
372
382
  }
@@ -376,9 +386,11 @@ export class FilesystemWorkspaceFiles {
376
386
  await Promise.all([sourceParent.close(), parent.close()]);
377
387
  return { kind: 'source-inside-destination' };
378
388
  }
379
- const target = await this.targetName(parent.path, basename(source), input.conflict, sourceMetadata.isFile() ? 'file' : 'directory');
389
+ const target = await this.targetName(parent.path, input.newName ?? basename(source), input.conflict, sourceMetadata.isFile() ? 'file' : 'directory');
380
390
  if (typeof target !== 'string') {
381
391
  await Promise.all([sourceParent.close(), parent.close()]);
392
+ if (input.newName && target.kind === 'conflict')
393
+ return { kind: 'conflict', replaceAllowed: false };
382
394
  return target;
383
395
  }
384
396
  try {
@@ -434,7 +446,9 @@ export class FilesystemWorkspaceFiles {
434
446
  conflict: input.conflict,
435
447
  };
436
448
  }
437
- catch {
449
+ catch (error) {
450
+ if (input.newName && error.code === 'EEXIST')
451
+ return { kind: 'conflict', replaceAllowed: false };
438
452
  return { kind: 'unreadable' };
439
453
  }
440
454
  finally {
@@ -690,6 +704,30 @@ async function stableAnchor(root, directory, anchor) {
690
704
  return false;
691
705
  }
692
706
  }
707
+ // Match directory components, so similarly named source files are copied normally.
708
+ const omittedCopyDirectories = new Set([
709
+ 'tmp',
710
+ 'temp',
711
+ '.tmp',
712
+ '.temp',
713
+ 'cache',
714
+ '.cache',
715
+ 'build',
716
+ 'dist',
717
+ 'node_modules',
718
+ '__pycache__',
719
+ '.pytest_cache',
720
+ '.mypy_cache',
721
+ '.ruff_cache',
722
+ '.next',
723
+ '.nuxt',
724
+ '.svelte-kit',
725
+ '.vite',
726
+ '.parcel-cache',
727
+ '.gradle',
728
+ '.turbo',
729
+ 'coverage',
730
+ ]);
693
731
  async function copyTree(source, target, directory) {
694
732
  if (!directory) {
695
733
  const sourceHandle = await open(source, constants.O_RDONLY | constants.O_NOFOLLOW);
@@ -705,7 +743,9 @@ async function copyTree(source, target, directory) {
705
743
  for (const name of await readdir(source)) {
706
744
  const childSource = join(source, name);
707
745
  const metadata = await lstat(childSource);
708
- if (metadata.isSymbolicLink() || name === '.git')
746
+ if (name === '.git' || (metadata.isDirectory() && omittedCopyDirectories.has(name)))
747
+ continue;
748
+ if (!metadata.isFile() && !metadata.isDirectory())
709
749
  throw new Error('unsupported source');
710
750
  if (metadata.isDirectory()) {
711
751
  const child = await openDirectory(childSource);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gestalt-mobile",
3
- "version": "0.77.1",
3
+ "version": "0.78.0",
4
4
  "description": "Mobile-first web relay for durable Codex development sessions",
5
5
  "keywords": [
6
6
  "codex",