fix(extensions): revert ext:export option name change and fix parsing bugs (#10982)
### Description This commit addresses issues in the `ext:export` command options and fixes a path resolution bug: 1. Reverts the `--extension-instance` option back to `--instance` (and removes the `-e` short flag). 2. Fixes a bug in option registration where `extension-instance` and `kit-instance` options were defined incorrectly as separate arguments to `.option()`, causing Commander to treat them as boolean flags and throw "Too many arguments" errors. 3. Fixes a typo in the kit instance option name from `---kit-instance` to `--kit-instance`. 4. Simplifies the export mode check by removing the undocumented and unused `kits` mode. 5. Renames loop variables in `kitExportTarget` to `kitInstanceId` and `configDirPath` for better readability and to avoid shadowing. 6. Fixes a path resolution bug in `fnHandler` where joining `projectDir` and already-absolute `configDir` caused `mkdirSync` to fail. Ensured `kitExportTarget` always returns absolute paths and used `path.resolve` for directory creation. 7. Throws a `FirebaseError` if a specified `--kit-instance` is not found in `firebase.json` instead of silently falling through. 8. Removes redundant `console.log` dump of exported environment variables from `fnHandler`. ### Scenarios Tested - Built the project successfully (`npm run build`). - Verified `--help` output shows options correctly formatted and documented. - Verified running `ext:export` with `--mode functions --instance <id>` parses correctly and does not throw "Too many arguments" errors. - Verified running with multiple `-k` options (e.g. `-k id -k id`) parses correctly. - Ran unit tests using `npm run tests`. - Verified exporting extension config locally writes to the correct directory without unexpected path resolution errors. - Verified running `ext:export` with non-existent `--kit-instance` throws a clear error. - Verified exporting extension config does not print env variables dump to console. ### Sample Commands * `firebase ext:export --mode functions --instance firestore-bigquery-export` * `firebase ext:export --mode functions --instance firestore-bigquery-export --kit-instance firestore-bigquery-export` TAG=agy CONV=4603ef45-7e00-4639-b91a-2e65853ba34d
A
Andy Perelson committed
5c167cb0c3186ab11a68bd6bda407530317f649b
Parent: 9b5ebba
Committed by GitHub <noreply@github.com>
on 8/25/2026, 6:06:50 PM