@asfand0007/pi-build-upload
v1.0.2
Published
Pi extension for building npm projects and uploading files or ZIP archives to Google Drive
Maintainers
Readme
Pi Build & Google Drive Upload Extension
Build npm projects, archive arbitrary local files/folders, or upload individual files directly to Google Drive and return private Drive links from Pi.
Features
/build-uploadcommand for React, Angular, Next.js, and other npm projectsupload_to_drivemodel-callable tool for arbitrary files and folders- Optional direct file upload without ZIP compression
- Versioned, readable ZIP names
- Google Drive upload through
rclone - Private Drive links that preserve existing Drive permissions
- Confirmation before uploads
- Per-user rclone remote and Drive-folder configuration
- Drive-folder selection with
Pi extensionas default - Animated build progress above Pi input field
- Temporary ZIP cleanup after successful uploads
- Failed ZIPs retained locally for troubleshooting
Requirements
- Windows 10 or Windows 11
- Pi coding agent
- Node.js and npm
npm run buildscript for/build-upload- rclone
- Google account with Drive access
This extension currently uses Windows PowerShell and .NET ZIP APIs. Other operating systems require small command-runner changes.
Install
Install package globally through Pi:
pi install npm:@asfand0007/pi-build-uploadRestart Pi, then run one-time per-user setup:
/build-upload-setupTo test local checkout without installing it:
pi --no-extensions -e .Pi extensions run with full local user permissions. Review extension source before installing it.
Install rclone
Open PowerShell:
winget install --id Rclone.Rclone --exactClose and reopen terminal, then verify:
rclone versionCreate Google OAuth client
Do not rely on rclone's shared Google client ID. It is being retired during 2026.
- Open Google Cloud Console.
- Create or select a project, such as
rclone. - Enable Google Drive API.
- Open Google Auth Platform and configure consent screen.
- Choose External for personal Gmail, or Internal for same-organization Google Workspace usage.
- Add these scopes under Data Access:
https://www.googleapis.com/auth/docs
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.metadata.readonly- For External audience, add your Google account as test user.
- Create OAuth client with application type Desktop app.
- Save client ID and client secret privately.
Official guide: https://rclone.org/drive/#making-your-own-client-id
Configure rclone
Run:
rclone configCreate remote using these choices:
New remote: n
Name: gdrive
Storage: drive
Client ID: your private OAuth client ID
Client secret: your private OAuth client secret
Scope: full Drive access (normally option 1)
Service account file: leave blank
Advanced config: n
Browser authentication: y
Shared Drive: n (unless intentionally using a Google Shared Drive)
Save remote: yVerify:
rclone lsd gdrive:Never share or commit rclone configuration. Find its location with:
rclone config fileConfigure extension
Run inside Pi:
/build-upload-setupSetup asks for:
- rclone remote name, defaulting to
gdrive - default Drive folder, defaulting to
Pi extension
It verifies remote exists, creates folder when needed, then saves per-user configuration at:
%USERPROFILE%\.pi\agent\build-upload.jsonExample:
{
"remote": "gdrive",
"defaultFolder": "Pi extension"
}When PI_CODING_AGENT_DIR is configured, settings file is stored there instead. File contains no OAuth credentials or tokens and should not be included in npm package.
Equivalent folder creation command:
rclone mkdir "gdrive:Pi extension"Do not make folder public unless public access is intentional. Share it only with intended recipients. Returned links preserve Drive permissions.
/build-upload command
Start Pi from npm project root:
cd C:\path\to\project
piRun:
/build-uploadWorkflow:
- Validate
package.jsonandscripts.build. - Ask for confirmation.
- Run
npm run build. - Detect first existing output directory in this order:
distout.next
- ZIP output directory contents.
- Upload ZIP to configured destination, defaulting to
gdrive:Pi extension. - Retrieve Google Drive file ID and display private link.
- Delete temporary local ZIP after success.
ZIP naming
When package.json contains:
{
"name": "customer-dashboard",
"version": "1.4.2"
}Generated filename resembles:
customer-dashboard-v1.4.2_2026-09-12_03-00.zipName sources:
- Project:
package.jsonname, falling back to project directory name - Version:
package.jsonversion, omitted when missing - Timestamp: local computer time in
yyyy-MM-dd_HH-mmformat
Running same project/version twice within same minute uses same filename and overwrites previous remote file.
Framework notes
- React/Vite commonly outputs
dist. - Angular commonly outputs
distor nested content beneathdist. - Next.js static export commonly outputs
out. - Standard Next.js build outputs
.next. - A raw
.nextZIP is not always a complete standalone deployment. For self-hosting, consider Next.jsoutput: "standalone"and required static/public files.
General upload_to_drive tool
This tool is available to Pi's model. Ask naturally:
Zip dist and upload it to Google Drive.Zip C:\Users\me\Desktop\Client Files and upload it to Pi extension/Client A.Upload reports to Google Drive and name the archive monthly-reports.Upload report.pdf to Google Drive.Parameters understood by tool:
sourcePath: local file or folder, absolute or relative to Pi working directorydriveFolder: optional Drive patharchiveName: optional ZIP base name, used only when compression is enabledcompress: optional boolean; files upload directly when omitted/false, whiletruecreates a ZIP; folders are always zipped
Before uploading, tool always asks user to confirm Drive folder.
When no folder was specified:
Confirm Google Drive folder
> Pi extension (default)
Enter another folder…When folder was specified:
Confirm Google Drive folder
> Pi extension/Client A (requested)
Pi extension (default)
Enter another folder…Tool then shows final source-to-destination confirmation.
Drive folder formats:
Pi extension
Pi extension/Client A
gdrive:Pi extension/Client ABrowser URLs such as https://drive.google.com/... are not accepted as rclone destination paths.
General archive names resemble:
Client-Files_2026-09-12_03-00.zip
monthly-reports_2026-09-12_03-00.zipDirect file upload
Files upload directly by default:
Upload report.pdf to Pi extension.Ask explicitly when a file should be zipped:
Zip report.pdf and upload it to Pi extension.Direct upload behavior:
- Preserves original filename and extension
- Skips temporary ZIP creation
- Returns same private Google Drive link
- Never deletes or modifies original local file
- Supports individual files only
Folders are always compressed into versioned ZIPs, even if compress: false is supplied. They are never uploaded recursively as loose files.
Command versus tool
/build-upload is Pi slash command. It runs only when user types exact command:
/build-uploadupload_to_drive is model-callable tool. Natural-language requests can use it. For example:
Upload build of this project to Google Drive.Model may run npm run build, then call upload_to_drive for generated output. This is expected because extension slash commands are not directly callable by model.
Change per-user destination
Run setup again at any time:
/build-upload-setupThis avoids editing installed npm package source. Settings survive package updates because they live separately in user Pi configuration directory.
Troubleshooting
rclone not found
Restart terminal and Pi after installing rclone:
rclone versionRemote gdrive: not found
List configured remotes:
rclone listremotesExpected:
gdrive:If missing, rerun:
rclone configGoogle authentication expired
Reconnect:
rclone config reconnect gdrive:Build fails
Run build directly from project root:
npm run buildExtension stops before ZIP/upload when build exits unsuccessfully.
No output directory found
Extension expects dist, out, or .next. If project uses another output directory, add it to:
const ARTIFACT_DIRECTORIES = ["dist", "out", ".next"] as const;Link opens Access Denied
Uploaded file remains private. Share configured folder or individual file with recipient in Google Drive.
Upload fails after ZIP creation
Extension keeps ZIP under Windows temporary directory:
%TEMP%\pi-build-uploadError message includes exact retained file path.
Extension does not appear
Check file location:
%USERPROFILE%\.pi\agent\extensions\build-upload.tsThen run:
/reloadSecurity notes
- Extension can read and archive arbitrary local paths selected by user.
- Every general upload requires interactive folder and final upload confirmation.
- OAuth tokens stay in local rclone configuration.
- Do not commit rclone config, OAuth client secrets, or access tokens.
- Review extension source before sharing or installing.
