kira-glasses-bridge 2.12.0 → 2.13.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.
- package/package.json +1 -1
- package/src/worktrees.mjs +9 -1
package/package.json
CHANGED
package/src/worktrees.mjs
CHANGED
|
@@ -237,9 +237,17 @@ function mimeOf(name) {
|
|
|
237
237
|
}
|
|
238
238
|
|
|
239
239
|
/** Files under an output folder of a worktree (a designer's design/, a researcher's docs/research/), with sizes and types. */
|
|
240
|
-
export async function listOutputs({ path: p, dir }) {
|
|
240
|
+
export async function listOutputs({ path: p, dir, only }) {
|
|
241
241
|
const path = resolveUserPath(String(p ?? ''))
|
|
242
242
|
const base = join(path, String(dir ?? '').replace(/^\/+|\/+$/g, ''))
|
|
243
|
+
// One named file (a terminal session's task_attach) may sit anywhere in the worktree, the root too.
|
|
244
|
+
if (typeof only === 'string' && only) {
|
|
245
|
+
const full = join(base, only)
|
|
246
|
+
if (only.includes('/') || !(base === path || base.startsWith(path + '/')) || !full.startsWith(path + '/')) return { error: 'bad output file' }
|
|
247
|
+
const s = await stat(full).catch(() => null)
|
|
248
|
+
if (!s?.isFile()) return { dir, files: [], bytes: 0 }
|
|
249
|
+
return { dir, files: [{ rel: only, bytes: s.size, mime: mimeOf(only) }], bytes: s.size }
|
|
250
|
+
}
|
|
243
251
|
if (!base.startsWith(path + '/')) return { error: 'bad output folder' }
|
|
244
252
|
const { readdir } = await import('node:fs/promises')
|
|
245
253
|
const out = []
|