nomoreide 0.1.58 → 0.1.59

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.
@@ -18,7 +18,7 @@
18
18
  }
19
19
  })();
20
20
  </script>
21
- <script type="module" crossorigin src="/assets/index-GFS7_3oL.js"></script>
21
+ <script type="module" crossorigin src="/assets/index-DdEyc0q8.js"></script>
22
22
  <link rel="stylesheet" crossorigin href="/assets/index-Ca7-Vu2E.css">
23
23
  </head>
24
24
  <body>
@@ -1,3 +1,11 @@
1
+ /**
2
+ * Virtual "This PC" root shown above the drive letters on Windows. `dirname`
3
+ * treats a drive root (`C:\`) as its own parent, so without this sentinel the
4
+ * picker dead-ends on whichever drive it started on and can never reach `D:\`
5
+ * etc. We surface this as the parent of any drive root and, when asked to list
6
+ * it, enumerate the available drives instead of hitting the filesystem.
7
+ */
8
+ export declare const WINDOWS_DRIVES_ROOT = "This PC";
1
9
  /**
2
10
  * List the contents of a directory for in-app browsing. Folders only by
3
11
  * default (the service cwd / repo pickers); pass `includeFiles` for the agent
@@ -15,3 +23,5 @@ export declare function listDirectories(path: string, { includeFiles }?: {
15
23
  isDir: boolean;
16
24
  }[];
17
25
  }>;
26
+ /** Parent of a path, or the drives root on Windows when at a drive root. */
27
+ export declare function parentOf(resolvedPath: string): string;
@@ -1,13 +1,31 @@
1
- import { readdir } from "node:fs/promises";
2
- import { dirname, resolve } from "node:path";
1
+ import { access, readdir } from "node:fs/promises";
2
+ import { posix, win32 } from "node:path";
3
3
  const ignoredDirectoryNames = new Set([".git", "node_modules"]);
4
+ // Evaluated per-call (not cached) so tests can exercise the Windows path.
5
+ const isWindows = () => process.platform === "win32";
6
+ // Resolve paths with the platform's own rules. On real Windows `node:path`
7
+ // already maps to `win32`; selecting it explicitly means a `win32`-stubbed
8
+ // test runs genuine Windows path semantics on any host (POSIX `dirname("C:\\")`
9
+ // is `"."`, whereas `win32.dirname("C:\\")` is `"C:\\"` — the whole bug).
10
+ const pathLib = () => (isWindows() ? win32 : posix);
11
+ /**
12
+ * Virtual "This PC" root shown above the drive letters on Windows. `dirname`
13
+ * treats a drive root (`C:\`) as its own parent, so without this sentinel the
14
+ * picker dead-ends on whichever drive it started on and can never reach `D:\`
15
+ * etc. We surface this as the parent of any drive root and, when asked to list
16
+ * it, enumerate the available drives instead of hitting the filesystem.
17
+ */
18
+ export const WINDOWS_DRIVES_ROOT = "This PC";
4
19
  /**
5
20
  * List the contents of a directory for in-app browsing. Folders only by
6
21
  * default (the service cwd / repo pickers); pass `includeFiles` for the agent
7
22
  * dock's file picker, which needs to attach individual files too.
8
23
  */
9
24
  export async function listDirectories(path, { includeFiles = false } = {}) {
10
- const resolvedPath = resolve(path);
25
+ if (isWindows() && path === WINDOWS_DRIVES_ROOT) {
26
+ return listWindowsDrives();
27
+ }
28
+ const resolvedPath = pathLib().resolve(path);
11
29
  const dirents = await readdir(resolvedPath, { withFileTypes: true });
12
30
  const entries = dirents
13
31
  .filter((entry) => entry.isDirectory()
@@ -15,7 +33,7 @@ export async function listDirectories(path, { includeFiles = false } = {}) {
15
33
  : includeFiles && entry.isFile())
16
34
  .map((entry) => ({
17
35
  name: entry.name,
18
- path: resolve(resolvedPath, entry.name),
36
+ path: pathLib().resolve(resolvedPath, entry.name),
19
37
  isDir: entry.isDirectory(),
20
38
  }))
21
39
  // Folders first, then files, each alphabetical.
@@ -27,8 +45,37 @@ export async function listDirectories(path, { includeFiles = false } = {}) {
27
45
  return {
28
46
  ok: true,
29
47
  path: resolvedPath,
30
- parent: dirname(resolvedPath),
48
+ parent: parentOf(resolvedPath),
31
49
  entries,
32
50
  };
33
51
  }
52
+ /** Parent of a path, or the drives root on Windows when at a drive root. */
53
+ export function parentOf(resolvedPath) {
54
+ const parent = pathLib().dirname(resolvedPath);
55
+ if (isWindows() && parent === resolvedPath)
56
+ return WINDOWS_DRIVES_ROOT;
57
+ return parent;
58
+ }
59
+ /** Enumerate available Windows drive letters as a "This PC" listing. */
60
+ async function listWindowsDrives() {
61
+ // Skip A:/B: to avoid the legacy "no floppy disk" prompt; C:–Z: covers every
62
+ // realistic fixed/removable/network drive.
63
+ const letters = Array.from({ length: 24 }, (_, i) => String.fromCharCode(67 + i));
64
+ const drives = await Promise.all(letters.map(async (letter) => {
65
+ const root = `${letter}:\\`;
66
+ try {
67
+ await access(root);
68
+ return { name: `${letter}:`, path: root, isDir: true };
69
+ }
70
+ catch {
71
+ return null;
72
+ }
73
+ }));
74
+ return {
75
+ ok: true,
76
+ path: WINDOWS_DRIVES_ROOT,
77
+ parent: WINDOWS_DRIVES_ROOT,
78
+ entries: drives.filter((drive) => drive !== null),
79
+ };
80
+ }
34
81
  //# sourceMappingURL=directories.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"directories.js","sourceRoot":"","sources":["../../src/web/directories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC;AAEhE;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,IAAY,EACZ,EAAE,YAAY,GAAG,KAAK,KAAiC,EAAE;IAEzD,MAAM,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,YAAY,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IACrE,MAAM,OAAO,GAAG,OAAO;SACpB,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAChB,KAAK,CAAC,WAAW,EAAE;QACjB,CAAC,CAAC,CAAC,qBAAqB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;QACxC,CAAC,CAAC,YAAY,IAAI,KAAK,CAAC,MAAM,EAAE,CACnC;SACA,GAAG,CAAC,C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1,6 @@
1
1
  {
2
2
  "name": "nomoreide",
3
- "version": "0.1.58",
3
+ "version": "0.1.59",
4
4
  "description": "An AI-native terminal workbench for services, Git review, logs, and MCP workflows.",
5
5
  "repository": {
6
6
  "type": "git",