Files
zeekay 1b367e2b62 chore: rebase the tree onto upstream master
The tree was a debranded snapshot of upstream taken around 2026-02-20, and
upstream has moved about five months since. This replaces it with upstream
master, mechanically re-derived: bin/debrand does the rename, and the
pipeline and squashed migrations are restored from the shipped tree.

Not a merge. The previous import replaced the tree wholesale in a single
commit, so there is no shared content history to merge against. Reproducing
the rename on the new tree is what actually converges.

What survives: .hanzo/workflows, the Dockerfiles and bin/docker* entrypoints,
compose files, LLM.md, and insights/migrations. The squashed initial
migration is load-bearing — the live database records it by name, so
upstream's ~918 individual migrations cannot come back.

Nine products are dropped as unreferenced. Twenty-one more that we do not run
are kept anyway because the core app still imports them; unpicking those is a
refactor and does not belong in a rebase.

This base does not build yet, and the reasons are not in the rename:
upstream now wants Python 3.13.13 against our 3.12.12 and Django 5.2 against
our 4.2, and the dependency manifests still name upstream packages that we
republish under our own names. Those are decisions, not renames.
2026-08-01 15:44:40 -07:00

83 lines
2.9 KiB
TypeScript

import { collectFilesFromDrop } from './skillFileUpload'
function fileEntry(name: string, fullPath: string): FileSystemFileEntry {
return {
isFile: true,
isDirectory: false,
name,
fullPath,
file: (resolve: (file: File) => void) => resolve(new File([`content of ${name}`], name)),
} as unknown as FileSystemFileEntry
}
function unreadableFileEntry(name: string, fullPath: string): FileSystemFileEntry {
return {
isFile: true,
isDirectory: false,
name,
fullPath,
file: (_resolve: (file: File) => void, reject: (error: Error) => void) => reject(new Error('not readable')),
} as unknown as FileSystemFileEntry
}
function directoryEntry(name: string, fullPath: string, children: FileSystemEntry[]): FileSystemDirectoryEntry {
return {
isFile: false,
isDirectory: true,
name,
fullPath,
createReader: () => {
// Serve children one per readEntries call, like Chrome batches large directories
let served = 0
return {
readEntries: (resolve: (entries: FileSystemEntry[]) => void) => {
resolve(served < children.length ? [children[served++]] : [])
},
}
},
} as unknown as FileSystemDirectoryEntry
}
function dropOf(entries: (FileSystemEntry | null)[]): DataTransfer {
return {
items: entries.map((entry) => ({
webkitGetAsEntry: () => entry,
getAsFile: () => null,
})),
files: [],
} as unknown as DataTransfer
}
describe('collectFilesFromDrop', () => {
it('recurses dropped folders, draining batched directory listings and skipping hidden or unreadable files', async () => {
const scripts = directoryEntry('scripts', '/scripts', [
fileEntry('setup.sh', '/scripts/setup.sh'),
fileEntry('run.py', '/scripts/run.py'),
fileEntry('.DS_Store', '/scripts/.DS_Store'),
unreadableFileEntry('locked.txt', '/scripts/locked.txt'),
directoryEntry('nested', '/scripts/nested', [fileEntry('deep.txt', '/scripts/nested/deep.txt')]),
])
const uploads = await collectFilesFromDrop(dropOf([scripts, fileEntry('guide.md', '/guide.md')]))
expect(uploads.map((u) => u.path)).toEqual([
'scripts/setup.sh',
'scripts/run.py',
'scripts/nested/deep.txt',
'guide.md',
])
expect(uploads[0].file.name).toBe('setup.sh')
})
it('falls back to the flat file list when the entry API is unavailable', async () => {
const dataTransfer = {
items: [],
files: [new File(['a'], 'a.txt'), new File(['b'], '.hidden')],
} as unknown as DataTransfer
const uploads = await collectFilesFromDrop(dataTransfer)
expect(uploads.map((u) => u.path)).toEqual(['a.txt'])
})
})