feat(platform): add init from-existing flag to sync app config into godaddy.toml - #254
feat(platform): add init from-existing flag to sync app config into godaddy.toml#254mguerrero3-godaddy wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
There are confirmed correctness/UX/security issues in the new --from-existing path (URL origin relativization, ignored flags, inconsistent URL validation, and a broken user-facing message) that should be addressed before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds a new gddy platform app init --from-existing <NAME> flow to sync an already-registered application’s remote config and latest release webhook subscriptions into godaddy.toml, aligning remote webhook URLs with local /webhooks/... conventions.
Changes:
- Add
--from-existing(+--force) toplatform app init, fetching app data and latest release subscriptions and writing them intogodaddy.toml. - Extend the app GraphQL query to include
clientIdand latest releasesubscriptions { name url events }. - Introduce
relativize_webhook_url(with tests) to convert same-origin webhook URLs to relative paths while preserving query/fragment.
File summaries
| File | Description |
|---|---|
| rust/src/config/mod.rs | Adds relativize_webhook_url helper + unit tests for URL/path normalization. |
| rust/src/application/commands/schemas.rs | Updates ApplicationInit output schema to allow fields omitted by --from-existing and adds optional subscriptions output. |
| rust/src/application/commands/init.rs | Implements --from-existing flow, subscription syncing, and overwrite safety prompt/--force behavior. |
| rust/src/application/client.rs | Extends ApplicationWithLatestRelease query and adds a test to assert the new selection set. |
Review details
Suppressed comments (1)
rust/src/application/commands/init.rs:154
- This non-interactive error message also contains the doubled apostrophe
'{name}''s ..., which will render incorrectly.
Err(cli_engine::CliCoreError::message(format!(
"local subscriptions.webhook has unpublished changes not present in '{name}''s \
latest release and would be overwritten: {subscriptions}. Run `gddy platform app \
release` first to publish them, or re-run with --force to discard them."
)))
- Files reviewed: 4/4 changed files
- Comments generated: 4
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
PR description:
Context
While testing dev platform It was clear the ties there exist between the app and the cli. On one of those experimentation steps, It was noticed that for applications created from the developer portal, there's no way to get Its godaddy.toml downloaded from the portal, neither generated from the CLI. For being able to, for example, register a webhook (which can't be done on the dev portal), a .toml file is needed to identify the app, and since the app was created on the portal, a manual creation of the .toml was necessary.
This isn't solving a bug, but rather proposing an extension to existent capabilities to generate a toml file reading the app config files, and also adding the ability for the CLI to reach the subscriptions (this don't expose a e.g.
platform app list subscription) as may be out of scope, (but that's doable with the changes here), but rather reads those to ensure those are correctly mapped to the .tomlChanges
gddy platform app init --from-existing <NAME>: fetches an already-registered application's remote config and its latest release's webhook subscriptions, and writes them into godaddy.toml, before this was only possible through the init (creating a new app)ApplicationWithLatestReleaseGraphQL query withclientIdandreleases.subscriptions { name url events }, and addsrelativize_webhook_urlso fetched webhook URLs come back in the same/webhooks/...shape as hand-authored entries.0.0.0);actions/dependencies/extensions/settingsare preserved from the existing local file, since those aren't tracked remotely.subscriptions.webhookhas entries not present in the latest published release (e.g. added viaadd subscriptionbut not yetreleased), the command prompts for confirmation (or errors non-interactively) unless--forceis passed.