Skip to content

feat: project download - #194

Merged
robsimmons merged 1 commit into
push-tnnlwlrukvwyfrom
push-vxyytpspwzuv
Oct 29, 2026
Merged

robsimmons merged 1 commit into
push-tnnlwlrukvwyfrom
push-vxyytpspwzuv

Conversation

@robsimmons

@robsimmons robsimmons commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Project cogwheel grows a new header — intentionally a MenuItem with a href and not a Next-ified MenuLinkItem, since we definitely don't want prefetching — which downloads a tarball without ever materializing it on the hard drive.

Learned a couple fun things in the process:

@robsimmons
robsimmons changed the base branch from main to push-tnnlwlrukvwy October 27, 2026 01:17
@Vtec234
Vtec234 added this pull request to stack #195 October 27, 2026 01:41
@Vtec234

Vtec234 commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

One potential surprise here is that this gets the project dir which wouldn't contain all the overlaid files (.lake/packages from package sets). That's probably better, though, since it reduces the tgz size.

Comment on lines +17 to +18
async function* generateProjectTgz(owner: { id: string }, projectId: string): AsyncGenerator<Uint8Array, void> {
const tar = spawn('tar', ['-czf', '-', '--exclude=./.lake', '.'], {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Vtec234 I'm actually explicitly excluding .lake in its entirety. If we have overlay files in the future that aren't part of .lake I'd think those should be part of the download.

@jcreedcmu

Copy link
Copy Markdown
Collaborator

Yeah, I think I would also cast a vote for excluding .lake for now until and unless we hear a user wanting different behavior (and having, like, a user-facing checkbox for include/exclude build files is a possible choice)

The value of including .lake is in the form of a convenience, i.e. making the transition from web to desktop a seamless "just works". But the tarball being small is also convenient.

Comment on lines +44 to +45
// 404 rather than 403 to avoid leaking the existence of inaccessible projects.
if (!project || !canAccessProject(session.user, project)) notFound()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought that needn't be for this PR but I'm noticing a repeated pattern: should we extract a helper function that makes "check if this project seems to exist according to our current auth'ed user" easier to naturally get right?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took a crack at this for #204

@robsimmons
robsimmons merged commit 39ed51f into main Oct 29, 2026
2 checks passed
@robsimmons
robsimmons deleted the push-vxyytpspwzuv branch October 29, 2026 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants